Beginner's logic (0 ms)
IntuitionApproachUse max function to find max length when encounter a smaller number, remember that the initial value of count is always 1 because we are compar
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
Use max function to find max length when encounter a smaller number, remember that the initial value of count is always 1 because we are comparing the number after, not the number earlier (check testcases to understand)
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
    int findMaxLength = INT_MIN;
    int count = 1, size = nums.size();
    if (size == 1) return 1;
    for (int i = 1; i < size; i++) {
        if (nums[i] < nums[i - 1]) {
            if (count > 1) {
                findMaxLength = max(findMaxLength, count);
                count = 1;
            }
        } else if (nums[i] > nums[i - 1]) count++;
        else {
            if (count > 1) {
                findMaxLength = max(findMaxLength, count);
                count = 1;
            }
        }
    } return max(findMaxLength, count);
}
};
```
['C++']