0Pricing
Competitive Programming Academy · Lesson

Longest Increasing Subsequence

O(n^2) DP then the O(n log n) trick.

What an LIS Is

A subsequence keeps order but skips elements. The longest increasing one is the longest such run that strictly rises.

a = [3, 1, 4, 1, 5, 9, 2]

Subsequence, Not Subarray

Unlike a subarray, an LIS need not be contiguous. You may jump over smaller numbers to keep the chain growing.

All lessons in this course

  1. Memoization vs Tabulation
  2. Define State and Transition
  3. Climbing Stairs & Coin Combinations
  4. Longest Increasing Subsequence
← Back to Competitive Programming Academy