As reported: Goldman Sachs Superday algorithms / data-structures rounds (2025): the length of the Longest Increasing Subsequence (Engineering Associate, USA, after implementing a HashMap); Longest Increasing Subsequence after Reverse Nodes in k-Group (Associate, Compliance Engineering).
Return the length of the longest strictly increasing subsequence of nums.
This is LeetCode 300 — Longest Increasing Subsequence.
Example 1
nums = [10,9,2,5,3,7,101,18]
-> 4
Example 2
nums = [0,1,0,3,2,3]
-> 4
Example 3
nums = [7,7,7,7,7,7,7]
-> 1
Constraints: 1 ≤ nums.length ≤ 2500; -10^4 ≤ nums[i] ≤ 10^4.
Code runner format: one JSON value per line: nums (LeetCode's test-case format). Implement lengthOfLIS(nums); the harness prints the result as JSON.