Data Structures & AlgorithmsHardProduct Company SDE · DP with binary search

Problem: Which of these is the standard O(n log n) algorithm for the longest increasing subsequence?

  1. A. Bellman-Ford
  2. B. Patience sorting with binary search on tails
  3. C. Floyd-Warshall
  4. D. Breadth-first search

Correct answer: B. Patience sorting with binary search on tails

The tails array is maintained with binary search, so each element costs O(log n).

More Coding Interview Problems questions

Exams that ask this topic