Python 3 Three Solutions Using Stack and Sliding Window and DP
Using Stack\npython\nclass Solution:\n    def findLengthOfLCIS(self, nums: List[int]) -> int:\n        if not nums:\n            return 0\n        if len(nums)=
**Using Stack**\n```python\nclass Solution:\n    def findLengthOfLCIS(self, nums: List[int]) -> int:\n        if not nums:\n            return 0\n        if len(nums)==1:\n            return 1\n        st = []\n        max_len = float(\'-inf\')\n        for i in range(len(nums)):\n            if not st:\n                st.append(nums[i])\n            elif st and st[-1]<nums[i]:\n                st.append(nums[i])\n            elif st and st[-1]>=nums[i]:\n                st = []\n                st.append(nums[i])\n            max_len = max(max_len,len(st))\n        return max_len\n```\n\n**Sliding Window**\n```python \nclass Solution:\n    def findLengthOfLCIS(self, nums: List[int]) -> int:\n        if len(nums)==1:\n            return 1\n        ans = 0 \n        ind = 0\n        for i in range(1,len(nums)):\n            if nums[i-1]>=nums[i]:\n                ind = i\n            ans = max(ans,i-ind+1)\n        return ans\n```\n\n\n**Dp Approach**\n```python\nclass Solution:\n    def findLengthOfLCIS(self, nums: List[int]) -> int:\n        if not nums:\n            return 0\n        dp = [1] * len(nums)\n        for i in range(1, len(nums)):\n            if nums[i] > nums[i-1]:\n                dp[i] = dp[i - 1] + 1\n        return max(dp)\n\t\t\n
[]