ORIGINAL CODING QUESTION
Longest growing milestones
Find the length of the longest strictly increasing subsequence of milestone scores. A subsequence preserves order but may skip entries; equal scores do not extend it.
Original exercise · hard. Editorial role relevance does not imply a company has asked this question.
Input and output
n, then n scores. Print the maximum length.
Constraints
1 ≤ n ≤ 10,000; -100,000 ≤ score ≤ 100,000.
Example 1
Input
6 3 1 2 2 4 3
Output
3
1, 2, 4 is one length-3 subsequence.
Example 2
Input
3 5 5 5
Output
1
Strictly increasing excludes equal scores.
Explain your approach
Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?
Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.
Hint 1
Consider the smallest possible ending score for each subsequence length.
Hint 2
Keep sorted minimal tails and find the first tail at least the new score.
Hint 3
Replace that tail, or append if none qualifies. The tails length is the answer; tails is not necessarily an actual subsequence.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →