🟢Beats 100.00% of users with Java, Easy Solution with Explanation
Keep growing \uD83D\uDE0A\n\n\n\n# Complexity\n\n- Time complexity: O(N)\n\n- Space complexity: O(1)\n\n\n# Explanation\n\nJavascript []\nStart\n  Initializatio
> ##### Keep growing \uD83D\uDE0A\n![image.png](https://assets.leetcode.com/users/images/886b45fe-9695-406f-a5eb-89b60bb2a074_1705236446.7537713.png)\n\n\n# Complexity\n\n- Time complexity: O(N)\n\n- Space complexity: O(1)\n\n\n# Explanation\n\n```Javascript []\nStart\n  Initialization: maxLength = 1, currentLength = 1\n  For loop (i = 1 to nums.length - 1)\n    If (nums[i] > nums[i - 1])\n      True: currentLength++\n      False: currentLength = 1\n    Update maxLength: maxLength = Math.max(maxLength, currentLength)\n  Repeat for the next iteration of the loop\n  End of loop\n  Return maxLength\nEnd\n```\n\n# Code\n\n```java []\nclass Solution {\n    public int findLengthOfLCIS(int[] nums) {\n    \n        int maxLength = 1;\n        int currentLength = 1;\n\n        for (int i = 1; i < nums.length; i++) {\n            if (nums[i] > nums[i - 1]) {\n                currentLength++;\n            } else {\n                currentLength = 1;\n            }\n\n            maxLength = Math.max(maxLength, currentLength);\n        }\n\n        return maxLength;\n    }\n}\n```\n##### If you have any question, feel free to ask. If you like the solution or the explanation, Please UPVOTE ! \u270C\uFE0F
['Array', 'Math', 'Java']