← All problems

Longest Increasing Subsequence

Medium dynamic programmingsearching LeetCode ↗
Given an integer array, find the length of the longest strictly increasing subsequence. The subsequence need not be contiguous. Improve on the O(n^2) DP if you can.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n log n), Space O(n)

Common pitfalls

  • Claiming tails IS the LIS
  • Non-strict comparison for strictly increasing

Your solution

Log in to save your code and track progress.