Dynamic programming · 10 / 15 Exercise Hard

Longest increasing subsequence

Objective

For each position you compute the length of the longest strictly increasing subsequence ending there, looking at all earlier positions with a smaller value. It costs O(n²).

Instructions

  • Read a line of integers (at least one).
  • Show Length: n with the length of the longest strictly increasing subsequence.
Input
10 9 2 5 3 7 101 18
Output
Length: 4

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise