Word Search — LC 79 DFS + Backtracking on Grid
LeetCode 79 is a FAANG grid backtracking classic. Use DFS with in-place visited marking to search a word path through a board in O(m*n*4^L).
1582 articles
LeetCode 79 is a FAANG grid backtracking classic. Use DFS with in-place visited marking to search a word path through a board in O(m*n*4^L).
LeetCode 334 looks like an LIS problem but ships in O(n) time and O(1) space using two greedy trackers. A classic FAANG follow-up to standard LIS.
LeetCode 18 generalizes 3Sum to four numbers with target sum. Sort, fix two indices, and run two pointers — O(n^3) time and clean duplicate handling.
LeetCode 45 asks for the minimum number of jumps to reach the end. A greedy BFS-layer approach gives O(n) time and O(1) space — a FAANG favorite.
LeetCode 134 — asked at Amazon, Google, and Microsoft. Find the unique valid starting station in a circular gas route using a two-insight greedy: global feasibility check plus a local reset that eliminates O(n) candidates at once, giving O(n) time and O(1) space.