problem

674. Longest Continuous Increasing Subsequence

solution

class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
int res = , cnt = , cur = INT_MAX;
for(auto num:nums)
{
if(num>cur) cnt++;
else cnt = ;
res = max(res, cnt);
cur = num;
}
return res;
}
};

solution2:

class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
int res = , cnt = ;
for(int i=; i<nums.size(); ++i)
{
if(i== || nums[i]>nums[i-]) res = max(res, ++cnt);
else cnt = ;
}
return res;
}
};

参考

1. Leetcode_easy_674. Longest Continuous Increasing Subsequence;

2. Grandyang;

【Leetcode_easy】674. Longest Continuous Increasing Subsequence的更多相关文章

  1. 【LeetCode】674. Longest Continuous Increasing Subsequence 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 空间压缩DP 日期 题目地址:https: ...

  2. leetcode300. Longest Increasing Subsequence 最长递增子序列 、674. Longest Continuous Increasing Subsequence

    Longest Increasing Subsequence 最长递增子序列 子序列不是数组中连续的数. dp表达的意思是以i结尾的最长子序列,而不是前i个数字的最长子序列. 初始化是dp所有的都为1 ...

  3. [LeetCode] 674. Longest Continuous Increasing Subsequence 最长连续递增序列

    Given an unsorted array of integers, find the length of longest continuous increasing subsequence. E ...

  4. LeetCode 674. Longest Continuous Increasing Subsequence (最长连续递增序列)

    Given an unsorted array of integers, find the length of longest continuous increasing subsequence. E ...

  5. [Leetcode]674. Longest Continuous Increasing Subsequence

    Given an unsorted array of integers, find the length of longest continuous increasing subsequence. E ...

  6. [LeetCode&Python] Problem 674. Longest Continuous Increasing Subsequence

    Given an unsorted array of integers, find the length of longest continuousincreasing subsequence (su ...

  7. 674. Longest Continuous Increasing Subsequence最长连续递增子数组

    [抄题]: Given an unsorted array of integers, find the length of longest continuous increasing subseque ...

  8. 674. Longest Continuous Increasing Subsequence@python

    Given an unsorted array of integers, find the length of longest continuous increasing subsequence (s ...

  9. LeetCode 674. Longest Continuous Increasing Subsequence最长连续递增序列 (C++/Java)

    题目: Given an unsorted array of integers, find the length of longest continuous increasing subsequenc ...

随机推荐

  1. Mac+appium+iOS 环境搭建

    Mac+appium+iOS 环境搭建,需要用到的信息如下,参考搭建环境. 1.安装brew,安装介绍:https://jingyan.baidu.com/article/fec7a1e5ec3034 ...

  2. 阿里云轻量级服务器和NGINX部署Django项目

    部署条件: 1.一台阿里云服务器(本人的是CentOS系统的服务器) 2.已经构建好的项目 3.服务器上安装并配置Nginx 首先第一步:在服务器上安装并配置Nginx 进入服务器 $ ssh roo ...

  3. [GraphQL] Query Lists of Multiple Types using a Union in GraphQL

    Unions are used when we want a GraphQL field or list to handle multiple types of data. With a Union ...

  4. 怎能使用echo 输出对象

     class A{         function __toString() {             return "怎么使用echo输出对象";          }   ...

  5. sublime 不是插件安装越多越好,如xxxsnippet 自动完成插件太多,就非常耗电脑性能,经常性的卡着不动

    sublime 不是插件安装越多越好,如xxxsnippet 自动完成插件太多,就非常耗电脑性能,经常性的卡着不动

  6. Spring事务采坑 —— timeout

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/qq_18860653/article/d ...

  7. Mina整体体系结构分析

    mina在应用程序中处于什么样的地位? mina屏蔽了一些网络通信细节对socket进行封装,并且基于NIO非阻塞框架,可以帮助我们快速开发网络通信,常常用于用户游戏开发,中间件等服务端应用程序.

  8. Es6请求封装

    function registryToast(){ vue.prototype.$toast=showToast } export default registryToast   import './ ...

  9. 节点(node)操作

    一.节点的属性 节点值页面中的所有内容,包括标签.属性.文本 nodeType,节点类型:如果是标签,则是1:如果是属性.则是2:如果是文本,则是3 nodeName,节点名字:如果是标签,则是大写的 ...

  10. Lucene4.2源码解析之fdt和fdx文件的读写(续)——fdx文件存储一个个的Block,每个Block管理着一批Chunk,通过docID读取到document需要完成Segment、Block、Chunk、document四级查询,引入了LZ4算法对fdt的chunk docs进行了实时压缩/解压

    2       索引读取阶段 当希望通过一个DocId得到Doc的全部内容,那么就需要对fdx/fdt文件进行读操作了.具体的代码在CompressingStoredFieldsReader类里面.与 ...