Longest Increasing Subsequence
Given an integer array nums, return the length of the longest strictly increasing subsequence.

30:00

Longest Increasing Subsequence
medium
Topics
Companies

Given an integer array nums, return the length of the longest strictly increasing subsequence.

Example 1:
Input: {"nums":[10,9,2,5,3,7,101,18]}
Output: 4
Constraints:
  • 1nums.length25001 \leq \text{nums.length} \leq 2500

  • 104nums[i]104-10^4 \leq \text{nums}[i] \leq 10^4

Input
arr ={"nums":[10,9,2,5,3,7,101,18]}

Init DP with 1s

Nums:

10

9

2

5

3

7

101

18

DP:

1

1

1

1

1

1

1

1

Max LIS Length:

1

Variables
VariableValue
len8
DepthFunction Call
Stack empty
0/71