Skip to content

Resource · Guide or article

Longest Increasing Subsequence

Defines the longest increasing subsequence problem and contrasts two time bounds, useful before tackling the DP and patience-style solutions.

Reviewed

Open the original: Longest Increasing Subsequence (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique. The longest increasing subsequence problem is solvable in time O(n log n), where n denotes the length of the input sequence. Dynamic programming approach has complexity O(n * n).

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Reference

What it covers

  • Complexity notes: O(n log n) is possible, while the dynamic programming approach is O(n * n).
  • Example on the first 16 terms of the binary Van der Corput sequence, with several length-six answers.

How to use it

PrepKit study advice, not a claim made by the source.

Code the O(n * n) DP, check it on the example sequence, and explain why more than one answer is valid.

Scope and limitations

The README states the O(n log n) bound without explaining the method. Further detail is left to Wikipedia and a YouTube video.

Access and format

Free English README on GitHub in the MIT-licensed trekhleb/javascript-algorithms repository.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/algorithms/sets/longest-increasing-subsequence/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email