The TransCompilator

Solved LeetCode program · 229 of 1,000

#0300 · Longest Increasing Subsequence

Medium Array chunk-05.md

Original English source

Keep a shared numbers holding 10, 9, 2, 5, 3, 7, 101, and 18. Keep a shared dp as an empty list of whole numbers.
For every spot from 0 to 7.
Place 1 into dp.

Keep a shared best of 0.

To extend from spot (a whole number) with before (a whole number). If before is at least spot, return. If item before of numbers is less than item spot of numbers and item before of dp plus 1 is more than best, set best to item before of dp plus 1. Extend from spot with before plus 1.

For every spot from 1 to 7.
Set best to 1. Extend from spot with 0. Set item spot of dp to best.

The answer is 1.
For each value in dp.
If value is more than answer, set answer to value.

Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

4