{"ScriptPreparationCode":null,"TestCases":[{"Name":"lengthOfLIS 1","Code":"function lengthOfLIS1(nums) {\r\n let dp = [ [nums[0]] ];\r\n for(let i of nums) {\r\n let f = false;\r\n // for every entry in the dynamic array check if i \u003E its last element\r\n for(let j of dp) {\r\n if(i \u003C= j[j.length-1]) {\r\n f = true;\r\n j[j.length-1] = i; break;\r\n }\r\n }\r\n if(!f) dp.push(dp[dp.length-1].concat([i]));\r\n }\r\n return nums.length \u003E 0 ? dp[dp.length-1].length : 0;\r\n};\r\n\r\nlengthOfLIS1(nums)","IsDeferred":false},{"Name":"lengthOfLIS 2","Code":"function lengthOfLIS2(nums) {\r\n var lis = [];\r\n for (var i = 0; i \u003C nums.length; i\u002B\u002B) {\r\n lis.push(1);\r\n for (var j = 0; j \u003C i; j\u002B\u002B) {\r\n if (nums[j] \u003C nums[i]) lis[i] = Math.max(lis[i], lis[j] \u002B 1);\r\n }\r\n }\r\n return nums.length ? Math.max.apply(null, lis) : 0;\r\n}\r\n\r\nlengthOfLIS2(nums)","IsDeferred":false}]}