Amazon Algorithm Questions - Practice Guide
1. Two Sum
Link: https://leetcode.com/problems/two-sum/
Approach: Use hashmap to store value:index and find complement.
2. Search in Rotated Sorted Array
Link: https://leetcode.com/problems/search-in-rotated-sorted-array/
Approach: Modified binary search.
3. Trapping Rain Water
Link: https://leetcode.com/problems/trapping-rain-water/
Approach: Two pointers or precompute leftMax/rightMax.
4. Longest Palindromic Substring
Link: https://leetcode.com/problems/longest-palindromic-substring/
Approach: Expand around center or DP.
5. Container With Most Water
Link: https://leetcode.com/problems/container-with-most-water/
Approach: Two-pointer approach from both ends.
6. Valid Parentheses
Link: https://leetcode.com/problems/valid-parentheses/
Approach: Use stack to match brackets.
7. Merge Intervals
Link: https://leetcode.com/problems/merge-intervals/
Approach: Sort and merge overlapping intervals.
8. Word Ladder
Link: https://leetcode.com/problems/word-ladder/
Approach: BFS with queue and visited set.
9. Maximum Subarray
Link: https://leetcode.com/problems/maximum-subarray/
Approach: Kadane's Algorithm.
10. Median of Two Sorted Arrays
Link: https://leetcode.com/problems/median-of-two-sorted-arrays/
Approach: Binary search partition.
11. Minimum Window Substring
Link: https://leetcode.com/problems/minimum-window-substring/
Approach: Sliding window with character count.
12. Kth Largest Element in an Array
Link: https://leetcode.com/problems/kth-largest-element-in-an-array/
Approach: Min-heap or Quickselect.
13. Clone Graph
Link: https://leetcode.com/problems/clone-graph/
Approach: DFS/BFS with hashmap.
14. Course Schedule
Link: https://leetcode.com/problems/course-schedule/
Approach: Topological sort (cycle detection).
15. Number of Islands
Link: https://leetcode.com/problems/number-of-islands/
Approach: DFS/BFS to explore all islands.
16. LRU Cache
Link: https://leetcode.com/problems/lru-cache/
Approach: Use HashMap + Doubly Linked List.
17. Top K Frequent Elements
Link: https://leetcode.com/problems/top-k-frequent-elements/
Approach: Hashmap + heap or bucket sort.
18. Product of Array Except Self
Link: https://leetcode.com/problems/product-of-array-except-self/
Approach: Prefix and suffix product arrays.
19. Find All Anagrams in a String
Link: https://leetcode.com/problems/find-all-anagrams-in-a-string/
Approach: Sliding window + char counts.
20. Longest Consecutive Sequence
Link: https://leetcode.com/problems/longest-consecutive-sequence/
Approach: Use set, check sequence starts.