Algorithms
All levelsSorting, dynamic programming, BFS/DFS, two pointers — with complexity analysis.
Overview
Key concepts
Must-know algorithms
Binary search · Merge sort / quick sort · Dynamic programming · Backtracking · Union-Find · Dijkstra's / Bellman-Ford · Topological sort
Complexity
Always state time and space complexity. Aim for O(n log n) or better. Know the trade-offs between time and space.
Question Bank
Practice questions
Common questions asked at Amazon for this topic. Check them off as you practice. Progress is saved in your browser.
Implement binary search and all its variants (first occurrence, last occurrence, rotated array).
EasyCoin Change: find the minimum number of coins to make amount N.
MediumLongest Increasing Subsequence (LIS) — find its length and reconstruct it.
MediumWord Break: can a string be segmented into words from a given dictionary?
MediumGenerate all permutations of a string or array (backtracking).
MediumTrapping Rain Water: given an elevation map, how much water can be trapped?
HardDetect a cycle in a directed graph.
MediumDijkstra's shortest path algorithm — implement it and state its time complexity.
HardResources
Go deeper
Free, curated materials to supplement your prep.