Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

天天算法 LeetCode-674-最长连续递增序列 #12

Closed
guanpengchn opened this issue May 24, 2019 · 3 comments
Closed

天天算法 LeetCode-674-最长连续递增序列 #12

guanpengchn opened this issue May 24, 2019 · 3 comments

Comments

@guanpengchn
Copy link
Owner

No description provided.

@guanpengchn
Copy link
Owner Author

打卡第7天

@intbjw
Copy link

intbjw commented May 24, 2019

【打卡】LeetCode-674-最长连续递增序列

#列表为[]有坑 class Solution: def findLengthOfLCIS(self, nums: List[int]) -> int: if len(nums) < 2: return len(nums) Max = 0 temp = 1 for i in range(1,len(nums)): if nums[i] > nums[i-1]: temp = temp + 1 else: temp = 1 Max = max(Max,temp) return Max

@Adnios
Copy link

Adnios commented May 24, 2019

【打卡】`class Solution {
public:
int findLengthOfLCIS(vector& nums) {
if(nums.empty()){
return 0;
}
int ans=1;
int tempans=1;
for(int i=1;i<nums.size();i++){
if(nums[i-1]>=nums[i]){
ans=max(ans,tempans);
tempans=1;
}
else{
tempans++;
}

    }
    ans=max(ans,tempans);
    return ans;
}

};`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants