JavaScript / TypeScript Solution
Code\n\n\nExample\n\n\n// cur=1, ans=1\n\n// [1,3,5,4,7] 3 > 1\n//  0 1 2 3 4  < i=1\n\n// cur=2, ans=2\n\n// [1,3,5,4,7] 5 > 3\n//  0 1 2 3 4  < i=2\n\n// cur=
# Code\n\n<details>\n<summary>Example</summary>\n\n```\n// cur=1, ans=1\n\n// [1,3,5,4,7] 3 > 1\n//  0 1 2 3 4  < i=1\n\n// cur=2, ans=2\n\n// [1,3,5,4,7] 5 > 3\n//  0 1 2 3 4  < i=2\n\n// cur=3, ans=3\n\n// [1,3,5,4,7] 4 > 5 \n//  0 1 2 3 4  < i=3\n\n// cur=1, ans=3\n\n// [1,3,5,4,7] 7 > 4 \n//  0 1 2 3 4  < i=4\n\n// cur=2, ans=3\n```\n</details>\n\n\n```\nfunction findLengthOfLCIS(nums: number[]): number {\n  let cur = 1;\n  let ans = 1;\n\n  for (let i = 1; i < nums.length; i++) {\n    // if (nums[i] > nums[i - 1]) {\n    //   cur += 1\n    //   ans = Math.max(cur, ans)\n    // } else {\n    //   cur = 1;\n    // }\n\n    // same above. using ternary operator\n    cur = nums[i] > nums[i - 1] ? cur + 1 : 1\n    ans = Math.max(cur, ans)\n  }\n\n  return ans\n};\n\n```\n\nUsing DP\n\n```\nfunction findLengthOfLCIS(nums: number[]): number {\n  const dp = new Array(nums.length).fill(1)\n\n  for (let i = 1; i < nums.length; i++) {\n    if (nums[i] > nums[i - 1]) {\n      dp[i] = dp[i - 1] + 1\n    }\n  }\n\n  return Math.max(...dp)\n};\n```
['Dynamic Programming', 'TypeScript', 'JavaScript']