Data Structures
All levelsArrays, trees, graphs, heaps — the patterns that appear most frequently at Amazon.
Overview
Key concepts
High-frequency structures
Arrays & strings · Hash maps · Linked lists · Binary trees · Graphs · Stacks & queues · Heaps / priority queues · Tries
Amazon patterns
Two pointers · Sliding window · BFS/DFS · Merge intervals · Tree traversal (inorder, preorder, postorder) · Fast & slow pointers
Question Bank
Practice questions
Common questions asked at Amazon for this topic. Check them off as you practice. Progress is saved in your browser.
Two Sum: find two numbers in an array that add up to a target value.
EasyFind the k most frequent elements in an array.
MediumMerge k sorted linked lists into one sorted list.
HardDesign an LRU Cache with O(1) get and put operations.
MediumFind the Lowest Common Ancestor (LCA) of two nodes in a binary tree.
MediumNumber of Islands: count connected groups of '1's in a 2D binary grid.
MediumSerialize and deserialize a binary tree.
HardMerge Intervals: given a list of intervals, merge all overlapping ones.
MediumFind the median of a data stream as elements are added one at a time.
HardResources
Go deeper
Free, curated materials to supplement your prep.