MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / lengthOfLIS

Function lengthOfLIS

javascript/0300-longest-increasing-subsequence.js:9–15  ·  view source on GitHub ↗
(nums)

Source from the content-addressed store, hash-verified

7 * @return {number}
8 */
9var lengthOfLIS = (nums) => {
10 const tabu = initTabu(nums); /* | Space O(N) */
11
12 linearSearch(nums, tabu); /* Time O(N * N) | Space O(N)*/
13
14 return Math.max(...tabu); /* Time O(N) */
15};
16
17const initTabu = (nums) => new Array(nums.length).fill(1);
18

Callers

nothing calls this directly

Calls 4

linearSortFunction · 0.85
logarithmicSortFunction · 0.85
initTabuFunction · 0.70
linearSearchFunction · 0.70

Tested by

no test coverage detected