Solution


  • 0
    B
    class Solution {
        public int findLengthOfLCIS(int[] nums) {
            int max = 1;
            int ans = 1;
          //  int sumSoFar = Integer.MIN_VALUE;
           if(nums.length == 0 )
               return 0;
           for(int i=0; i<nums.length-1; i++)
            {
                if(nums[i+1] > (nums[i]))
                {
                    ++max;
                    if(max > ans) 
                    {
                        ans = max;
                    }
                   // sumSoFar = sumSoFar + nums[i];
                }
                else
                {
                    max=1;
                    //sumSoFar = Integer.MIN_VALUE;
                }
            }
            return ans;
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.