Google — Staircase Search in Row-Column Sorted Matrix
Search for a target in a matrix where each row and column is sorted. O(m+n) solution using top-right corner elimination — a classic Google interview problem.
1575 articles
Search for a target in a matrix where each row and column is sorted. O(m+n) solution using top-right corner elimination — a classic Google interview problem.
Derive character ordering from a sorted alien dictionary using topological sort. Build a directed graph from adjacent word comparisons and apply Kahn's BFS algorithm.
Find the maximum in every sliding window of size k using a monotonic decreasing deque. O(n) solution that Google uses to test understanding of amortised data structures.
Find the smallest substring of s containing all characters of t using an expanding/contracting two-pointer window with frequency counting. O(n) time.
Implement an iterator for a nested list that flattens it lazily. Meta favors this for testing iterator design, stack usage, and lazy evaluation.