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?
- A. Bellman-Ford
- B. Patience sorting with binary search on tails
- C. Floyd-Warshall
- 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
- Problem: What is the standard complexity of computing all pairs of shortest paths in a graph with V vertices using repeated squaring of…
- Problem: Which result says that every planar graph is 5-colourable?
- Problem: What is the purpose of the 'lowest common multiple of the array' technique in competitive programming?
- Problem: In counting sort, what limits its use on a large input?
- Problem: What does the expression 'x & (x - 1)' clear in the binary representation of x?
- Problem: Which algorithm solves the 'minimum cost to connect all points' in the Euclidean plane with n points in O(n^2) time (dense graph)?