BugForge
DSA

Longest Rising Sales Streak (Subsequence)

Mediumdynamic programmingbinary search 00:00

Return the length of the longest strictly increasing subsequence of sales (not necessarily contiguous).

Signature

lisLength(sales: int[]) → int
Example 1
sales = [10,9,2,5,3,7,101,18]
output = 4
2, 3, 7, 101 → 4
Example 2
sales = [7,7,7]
output = 1
strict → 1

Constraints

  • 1 ≤ n ≤ 10^5
Run checks the examples. Submit runs every hidden test (17, including large inputs that catch slow solutions).