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:就,,,跟着思路做就是了!

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务