Skip to main content

Amazon Coding Interview Questions

295 problems · 38 Easy 238 Medium 19 Hard
✓ Interview Solutions & Breakdown Practice Mode Enabled
← All problems

Amazon problems

Amazon is the most-covered company in this dataset. The loop is anchored by Leadership Principles, and the coding bar is medium-heavy with emphasis on two pointers, sliding window, and hashing. Verbalize your approach before writing code, and expect follow-ups that tighten the constraints.

📋

Amazon Interview Loop Structure

🔄
Rounds: Online Assessment (2 coding questions + work style) + 4–5 round onsite loop
💻
Coding Style: Medium-heavy problems. Two pointers, sliding window, heaps, and hash maps are top priorities.
🏗
System Design: Required for SDE-II and above. High-scale microservices, data storage selection, and asynchronous queuing.
🎯
Behavioral: Amazon 16 Leadership Principles: Customer Obsession, Ownership, Bias for Action, Dive Deep. Bar Raiser round included.
💡
Pro Tips:
  • • Format every behavioral response strictly using the STAR method
  • • Verbalize test cases and edge cases explicitly
  • • Demonstrate frugal and pragmatic architectural trade-offs
🎯

4-Week Preparation Strategy for Amazon

Action Plan

To maximize your offer probability at Amazon, avoid random LeetCode grinding. Follow this structured 4-week roadmap tailored to Amazon's specific interview loop and evaluation bar:

Week 1: High-Frequency Patterns

Focus on foundational patterns tested heavily at Amazon: Two Pointers, Sliding Window, and Hash Map frequency tracking. Solve 10–12 Easy/Medium questions and establish code muscle memory without syntax lookups.

Week 2: Advanced Graph & Tree Drills

Master BFS, DFS, Topological Sorting, and Priority Queues (Min/Max Heaps). Practice articulating state transitions and recursion stack depth trade-offs under real-time interviewer pressure.

Week 3: Timed Mock Coding & Complexity

Simulate real 45-minute technical screens. Spend 5 minutes clarifying requirements, 10 minutes discussing brute-force vs optimal trade-offs, 20 minutes coding cleanly, and 10 minutes dry-running boundary test cases.

Week 4: System Architecture & Behavioral STAR

Draft 5 distinct STAR method stories (Situation, Task, Action, Result) mapped to Amazon's core principles. Review distributed systems fundamentals: caching tiers, partitioning, rate limiting, and database consistency models.

💡 What Amazon Interviewers Evaluate:

Interviewers score candidates across 4 independent pillars: Algorithmic Optimality (arriving at optimal Big-O), Code Craftsmanship (modular functions, clean naming, zero syntax debt), Communication & Thinking Out Loud (proactive collaboration, asking clarifying questions), and Edge Case Rigor (null checks, integer overflows, duplicate inputs).

Sliding Window 24 problems
Problem Difficulty Solution Link
Longest Substring Without Repeating Characters
#String #Hash Map #Sliding Window
Medium Solution
Minimum Window Substring
#String #Hash Map #Sliding Window
Hard Solution
Sliding Window Maximum
#Array #Deque #Sliding Window
Hard Solution
Longest Repeating Character Replacement
#String #Sliding Window
Medium Solution
Permutation in String
#String #Hash Map #Sliding Window
Medium Solution
Max Consecutive Ones III
#Array #Sliding Window #Binary
Medium Solution
Subarray Product Less Than K
#Array #Sliding Window
Medium Solution
Minimum Size Subarray Sum
#Array #Sliding Window #Binary Search
Medium Solution
Minimum Operations to Reduce X to Zero
#Array #Hash Table #Binary Search
Medium Solution
Longest Subarray of 1's After Deleting One Element
#Array #Dynamic Programming #Sliding Window
Medium Solution
Count Number of Nice Subarrays
#Array #Hash Table #Math
Medium Solution
Frequency of the Most Frequent Element
#Array #Binary Search #Greedy
Medium Solution
Consecutive 1's not allowed
#String
Medium Solution
Minimum changes to make alternating binary string
#String
Medium Solution
String to Integer
#String
Medium Solution
Length of Last Word
#String
Medium Solution
Run Length Encoding
#String
Medium Solution
Longest Common Prefix
#String
Medium Solution
Largest Alphabetic Character present in the String
#String
Medium Solution
Roman to Integer
#String
Medium Solution
Integer to Roman
#String
Medium Solution
First Unique Character in a String
#String
Medium Solution
Valid Tic Toe State
#String
Medium Solution
Find the Index of the First Occurrence in a String
#String
Medium Solution
Two Pointers 48 problems
Problem Difficulty Solution Link
Two Sum II - Input Array Is Sorted
#Array #Two Pointers #Binary Search
Medium Solution
3Sum
#Array #Two Pointers #Sorting
Medium Solution
Container With Most Water
#Array #Two Pointers #Greedy
Medium Solution
Trapping Rain Water
#Array #Two Pointers #Stack
Hard Solution
Valid Palindrome
#String #Two Pointers
Easy Solution
4Sum
#Array #Sorting #Two Pointers
Medium Solution
Sort Colors
#Array #Sorting #Two Pointers
Medium Solution
Squares of a Sorted Array
#Array #Two Pointers #Sorting
Easy Solution
Boats to Save People
#Array #Two Pointers #Greedy
Medium Solution
Valid Palindrome II
#String #Greedy #Two Pointers
Easy Solution
Encode and Decode Strings
#Array #String #Design
Medium Solution
Best Time to Buy and Sell the Stocks - 2
#Array
Medium Solution
3Sum Closest
#Array
Medium Solution
Intersection of two Arrays
#Array
Medium Solution
Maximum Sum Rectangle
#Array
Medium Solution
Rotate Array
#Array
Medium Solution
Majority Element
#Array
Easy Solution
Majority Element II
#Array
Easy Solution
Next Greater Element III
#Array
Medium Solution
Merge Sort
#Array
Medium Solution
Count Inversions
#Array
Medium Solution
First Missing Positive
#Array
Medium Solution
Repeat and Missing Number Array
#Array
Medium Solution
Minimum Platforms
#Array
Medium Solution
Max sum path in two arrays
#Array
Medium Solution
Pairs of Songs With Total Durations Divisible by 60
#Array
Medium Solution
Rectangle Overlap
#Array
Medium Solution
Find the Duplicate Number
#Array
Medium Solution
Segregate Even and Odd numbers
#Array
Medium Solution
Subarray with 0 sum exist
#Array
Medium Solution
Count Numbers with Unique Digits
#Array
Medium Solution
Distribute Candies
#Array
Medium Solution
Transpose Matrix
#Array
Medium Solution
Pascals Triangle
#Array
Medium Solution
Insert Delete GetRandom in O
#Array
Medium Solution
Sign of the Product of an Array
#Array
Medium Solution
Find N Unique Integers Sum up to Zero
#Array
Medium Solution
Shuffle an Array
#Array
Medium Solution
Count Primes
#Array
Medium Solution
Power of Three
#Array
Medium Solution
Hamming Distance
#Array
Medium Solution
Excel Sheet Column Number
#Array
Medium Solution
Excel Sheet Column Title
#Array
Medium Solution
Happy Number
#Array
Medium Solution
Assign Cookies
#Array
Medium Solution
Reverse words in a given string
#String
Medium Solution
Reverse Words in a String
#String
Medium Solution
Minimum Number of Moves to Make Palindrome
#String
Medium Solution
Prefix Sum 8 problems
Problem Difficulty Solution Link
Subarray Sum Equals K
#Array #Hash Map #Prefix Sum
Medium Solution
Product of Array Except Self
#Array #Prefix Product
Medium Solution
Range Sum Query - Immutable
#Array #Design #Prefix Sum
Easy Solution
Find Pivot Index
#Array #Prefix Sum
Easy Solution
Running Sum of 1D Array
#Array #Prefix Sum
Easy Solution
Minimum Average Difference
#Array #Prefix Sum
Medium Solution
Max Chunks To Make Sorted
#Array
Medium Solution
Max Chunks To Make Sorted II
#Array
Medium Solution
Hash Map / Set 11 problems
Problem Difficulty Solution Link
Two Sum
#Array #Hash Map
Easy Solution
Group Anagrams
#String #Hash Map #Sorting
Medium Solution
Top K Frequent Elements
#Array #Hash Map #Heap
Medium Solution
Valid Anagram
#String #Hash Map #Sorting
Easy Solution
Longest Consecutive Sequence
#Array #Hash Set
Medium Solution
Contains Duplicate
#Array #Hash Table #Sorting
Easy Solution
Isomorphic Strings
#Hash Table #String
Easy Solution
LRU Cache
#Hash Table #Linked List #Design
Medium Solution
4Sum II
#Array #Hash Table
Medium Solution
Number of Good Pairs
#Array #Hash Table #Math
Easy Solution
Subarray Sum Divisible by K
#Array #Hash Table #Prefix Sum
Medium Solution
Queue / BFS 10 problems
Problem Difficulty Solution Link
Number of Islands
#Array #DFS #BFS
Medium Solution
Rotting Oranges
#Array #BFS #Matrix
Medium Solution
Binary Tree Level Order Traversal
#Tree #BFS
Medium Solution
Word Ladder
#Hash Set #BFS #String
Hard Solution
01 Matrix
#Array #BFS #Matrix
Medium Solution
Walls and Gates
#Array #BFS #Matrix
Medium Solution
Shortest Path in Binary Matrix
#Array #BFS #Matrix
Medium Solution
Open the Lock
#Array #Hash Table #BFS
Medium Solution
Minimum Genetic Mutation
#Hash Table #String #BFS
Medium Solution
Jump Game III
#Array #DFS #BFS
Medium Solution
Problem Difficulty Solution Link
Kth Largest Element in an Array
#Array #Heap #Sorting
Medium Solution
Find Median from Data Stream
#Two Heaps #Design #Sorting
Hard Solution
Task Scheduler
#Array #Heap #Greedy
Medium Solution
Merge K Sorted Lists
#Linked List #Heap #Divide and Conquer
Hard Solution
K Closest Points to Origin
#Array #Math #Divide and Conquer
Medium Solution
Reorganize String
#Hash Table #String #Greedy
Medium Solution
Top K Frequent Words
#Hash Table #String #Trie
Medium Solution
Find K Pairs with Smallest Sums
#Array #Heap
Medium Solution
Minimum Cost to Connect Sticks
#Array #Greedy #Heap
Medium Solution
Sort an Almost Sorted Array
#Heap #Priority Queue
Medium Solution
Find K Closest Elements
#Heap #Priority Queue
Medium Solution
Connect Ropes to Minimize the Cost
#Heap #Priority Queue
Medium Solution
The sum of Elements between k1 smallest and k2 smallest numbers
#Heap #Priority Queue
Medium Solution
Kth Largest Element in a Stream
#Heap #Priority Queue
Medium Solution
Linked List 24 problems
Problem Difficulty Solution Link
Reverse Linked List
#Linked List #Recursion
Easy Solution
Linked List Cycle
#Linked List #Two Pointers #Hash Table
Easy Solution
Merge Two Sorted Lists
#Linked List #Recursion
Easy Solution
Reorder List
#Linked List #Two Pointers #Stack
Medium Solution
Add Two Numbers
#Linked List #Math #Recursion
Medium Solution
Remove Nth Node From End of List
#Linked List #Two Pointers
Medium Solution
Copy List with Random Pointer
#Hash Table #Linked List
Medium Solution
Palindrome Linked List
#Linked List #Two Pointers #Stack
Easy Solution
Swap Nodes in Pairs
#Linked List #Recursion
Medium Solution
Rotate List
#Linked List #Two Pointers
Medium Solution
Reverse Nodes in k-Group
#Linked List #Recursion
Hard Solution
Find the intersection of two linked lists
#Linked List
Medium Solution
Middle of the Linked List
#Linked List
Easy Solution
Add Two Numbers Represented in Linked List
#Linked List
Medium Solution
Linked List Cycle II
#Linked List
Medium Solution
Remove Duplicates from Sorted List
#Linked List
Easy Solution
Remove Duplicates from Sorted List - II
#Linked List
Easy Solution
Add Two Numbers II
#Linked List
Medium Solution
Odd Even Linked List
#Linked List
Medium Solution
Reverse a Linked List in groups of given size k
#Linked List
Medium Solution
Reverse Linked List II
#Linked List
Medium Solution
Convert Binary Number in a Linked List to Integer
#Linked List
Medium Solution
Partition List
#Linked List
Medium Solution
Sort List
#Linked List
Medium Solution
Trees / DFS 18 problems
Problem Difficulty Solution Link
Invert Binary Tree
#Tree #DFS #BFS
Easy Solution
Maximum Depth of Binary Tree
#Tree #DFS #BFS
Easy Solution
Validate Binary Search Tree
#Tree #DFS #BST
Medium Solution
Lowest Common Ancestor of a BST
#Tree #DFS #BST
Medium Solution
Binary Tree Maximum Path Sum
#Tree #DFS #DP
Hard Solution
Serialize and Deserialize Binary Tree
#Tree #DFS #BFS
Hard Solution
Diameter of Binary Tree
#Tree #DFS #Binary Tree
Easy Solution
Symmetric Tree
#Tree #DFS #BFS
Easy Solution
Binary Tree Right Side View
#Tree #DFS #BFS
Medium Solution
Kth Smallest Element in a BST
#Tree #DFS #BST
Medium Solution
Construct Binary Tree from Preorder and Inorder Traversal
#Array #Hash Table #Divide and Conquer
Medium Solution
Path Sum II
#Backtracking #Tree #DFS
Medium Solution
Count Good Nodes in Binary Tree
#Tree #DFS #BFS
Medium Solution
Flatten Binary Tree to Linked List
#Linked List #Stack #Tree
Medium Solution
Sum Root to Leaf Numbers
#Tree #DFS #BFS
Medium Solution
Populating Next Right Pointers in Each Node
#Linked List #Tree #DFS
Medium Solution
Same Tree
#Tree #Depth-First Search #Breadth-First Search
Easy Solution
Subtree of Another Tree
#Tree #Depth-First Search #String Matching
Easy Solution
Graphs 9 problems
Problem Difficulty Solution Link
Clone Graph
#Graph #DFS #BFS
Medium Solution
Pacific Atlantic Water Flow
#Graph #DFS #BFS
Medium Solution
Number of Connected Components in Undirected Graph
#Graph #DFS #Union Find
Medium Solution
Minimum Height Trees
#DFS #BFS #Graph
Medium Solution
Network Delay Time
#DFS #BFS #Graph
Medium Solution
Find Eventual Safe States
#DFS #BFS #Graph
Medium Solution
All Paths From Source to Target
#Backtracking #DFS #BFS
Medium Solution
Cheapest Flights Within K Stops
#Dynamic Programming #DFS #BFS
Medium Solution
Graph Valid Tree
#Depth-First Search #Breadth-First Search #Union Find
Medium Solution
Problem Difficulty Solution Link
Climbing Stairs
#DP #Math #Memoization
Easy Solution
House Robber
#Array #DP
Medium Solution
Coin Change
#Array #DP #BFS
Medium Solution
Longest Increasing Subsequence
#Array #DP #Binary Search
Medium Solution
Longest Common Subsequence
#String #DP
Medium Solution
Word Break
#String #DP #Hash Set
Medium Solution
Edit Distance
#String #DP
Hard Solution
Unique Paths
#Math #DP #Combinatorics
Medium Solution
Maximum Subarray
#Array #DP #Divide and Conquer
Medium Solution
Decode Ways
#String #DP
Medium Solution
Min Cost Climbing Stairs
#Array #Dynamic Programming
Easy Solution
House Robber II
#Array #Dynamic Programming
Medium Solution
Partition Equal Subset Sum
#Array #Dynamic Programming
Medium Solution
Target Sum
#Array #Dynamic Programming #Backtracking
Medium Solution
Best Time to Buy and Sell Stock
#Array #Dynamic Programming
Easy Solution
Palindromic Substrings
#String #Dynamic Programming
Medium Solution
Longest Palindromic Substring
#String #Dynamic Programming
Medium Solution
Best Time to Buy and Sell Stock with Cooldown
#Array #Dynamic Programming
Medium Solution
Maximum Product Subarray
#Array #Dynamic Programming
Medium Solution
Triangle
#Array #Dynamic Programming
Medium Solution
Minimum Path Sum
#Array #Dynamic Programming #Matrix
Medium Solution
Perfect Squares
#Math #Dynamic Programming #BFS
Medium Solution
Regular Expression Matching
#String #Dynamic Programming #Recursion
Hard Solution
Interleaving String
#String #Dynamic Programming #BFS
Medium Solution
Best Time to Buy and Sell Stock with Transaction Fee
#Array #Dynamic Programming #Greedy
Medium Solution
Greedy 6 problems
Problem Difficulty Solution Link
Jump Game
#Array #Greedy #DP
Medium Solution
Jump Game II
#Array #Greedy #DP
Medium Solution
Gas Station
#Array #Greedy
Medium Solution
Meeting Rooms II
#Array #Greedy #Sorting
Medium Solution
Minimum Number of Arrows to Burst Balloons
#Array #Greedy #Sorting
Medium Solution
Candy
#Array #Greedy
Hard Solution
Backtracking 14 problems
Problem Difficulty Solution Link
Permutations
#Array #Backtracking
Medium Solution
Subsets
#Array #Backtracking #Bit Manipulation
Medium Solution
Combination Sum
#Array #Backtracking
Medium Solution
Word Search
#Array #Matrix #Backtracking
Medium Solution
Letter Combinations of a Phone Number
#Hash Table #String #Backtracking
Medium Solution
Generate Parentheses
#String #Dynamic Programming #Backtracking
Medium Solution
N-Queens
#Array #Backtracking
Hard Solution
Palindrome Partitioning
#String #Dynamic Programming #Backtracking
Medium Solution
Combination Sum II
#Array #Backtracking
Medium Solution
Subsets II
#Array #Backtracking #Bit Manipulation
Medium Solution
Next Permutation
#Array
Medium Solution
Find all permutations of a string
#String
Medium Solution
Find all permutations of a given string without duplicates
#String
Medium Solution
Longest Valid Parentheses
#String
Easy Solution
Trie 3 problems
Problem Difficulty Solution Link
Implement Trie (Prefix Tree)
#Design #Trie
Medium Solution
Word Search II
#Array #String #Backtracking
Hard Solution
Replace Words
#Array #Hash Table #String
Medium Solution
Union Find 6 problems
Problem Difficulty Solution Link
Redundant Connection
#Graph #Union Find #DFS
Medium Solution
Accounts Merge
#Graph #Union Find #DFS
Medium Solution
Number of Provinces
#DFS #BFS #Union-Find
Medium Solution
Satisfiability of Equality Equations
#Array #String #Union-Find
Medium Solution
Swim in Rising Water
#Array #Binary Search #DFS
Hard Solution
Most Stones Removed with Same Row or Column
#Hash Table #DFS #Union-Find
Medium Solution
Problem Difficulty Solution Link
Largest Rectangle in Histogram
#Array #Stack #Monotonic Stack
Hard Solution
Sum of Subarray Minimums
#Array #Dynamic Programming #Stack
Medium Solution
Online Stock Span
#Stack #Design #Monotonic Stack
Medium Solution
132 Pattern
#Array #Binary Search #Stack
Medium Solution
Stock Span Problem
#Stack
Medium Solution
Problem Difficulty Solution Link
Course Schedule
#Graph #DFS #BFS
Medium Solution
Course Schedule II
#Graph #DFS #BFS
Medium Solution
Parallel Courses
#Graph #Topological Sort #BFS
Medium Solution
Alien Dictionary
#Array #String #Graph
Hard Solution
Problem Difficulty Solution Link
Single Number
#Array #Bit Manipulation
Easy Solution
Missing Number
#Array #Math #Bit Manipulation
Easy Solution
Reverse Bits
#Divide and Conquer #Bit Manipulation
Easy Solution
Sum of Two Integers
#Math #Bit Manipulation
Medium Solution
Single Number II
#Array #Bit Manipulation
Medium Solution
Intervals 3 problems
Problem Difficulty Solution Link
Merge Intervals
#Array #Sorting
Medium Solution
Minimum Interval to Include Each Query
#Array #Binary Search #Line Sweep
Hard Solution
Meeting Rooms
#Array #Sorting
Easy Solution
Matrix 7 problems
Problem Difficulty Solution Link
Rotate Image
#Array #Matrix #Math
Medium Solution
Spiral Matrix
#Array #Matrix #Simulation
Medium Solution
Set Matrix Zeroes
#Array #Matrix
Medium Solution
Maximal Square
#Array #Dynamic Programming #Matrix
Medium Solution
Game of Life
#Array #Matrix #Simulation
Medium Solution
Search a 2D Matrix II
#Array #Binary Search #Divide and Conquer
Medium Solution
Count Negative Numbers in a Sorted Matrix
#Array #Binary Search #Matrix
Easy Solution
Buy me a coffee
Daily Practice
0/0