LeetCode 674. 最长连续递增序列

LeetCode 674. 最长连续递增序列

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

解题思路:

难点1:就,,,跟着思路做就是了!

全部评论

相关推荐

积极的小学生不要香菜:你才沟通多少,没500不要说难
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务