Blind 75 + Amazon top 50 Flashcards
Memorize the best questions
1.Two Sum
Empty
2.Longest Substring Without Repeating Characters
Empty
3.Longest Palindromic Substring
Empty
4.Container With Most Water
Empty
5.3Sum
Empty
6.Remove Nth Node From End of List
Empty
7.Valid Parentheses
Empty
8.Merge Two Sorted Lists
Empty
9.Merge k Sorted Lists
Empty
10.Search in Rotated Sorted Array
Empty
11.Combination Sum
Empty
12.Trapping Rain Water
Empty
13.Rotate Image
Empty
14.Group Anagrams
Empty
15.Maximum Subarray
Empty
16.Spiral Matrix
Empty
17.Jump Game
Empty
18.Merge Intervals
Empty
19.Insert Interval
Empty
20.Unique Paths
Empty
21.Climbing Stairs
Empty
22.Set Matrix Zeroes
Empty
23.Minimum Window Substring
Empty
24.Word Search
Empty
25.Decode Ways
Empty
26.Validate Binary Search Tree
Empty
27.Recover Binary Search Tree
Empty
28.Same Tree
Empty
29.Binary Tree Level Order Traversal
Empty
30.Maximum Depth of Binary Tree
Empty
31.Construct Binary Tree from Preorder and Inorder Traversal
Empty
32.Best Time to Buy and Sell Stock
Empty
33.Binary Tree Maximum Path Sum
Empty
34.Valid Palindrome
Empty
35.Word Ladder II
Empty
36.Word Ladder
Empty
37.Longest Consecutive Sequence
Empty
38.Clone Graph
Empty
39.Copy List with Random Pointer
Empty
40.Word Break
Empty
41.Word Break II
Time complexity is legit
42.Linked List Cycle
Empty
43.Reorder List
Empty
44.LRU Cache
Empty
45.Maximum Product Subarray
Empty
46.Find Minimum in Rotated Sorted Array
Empty
47.Min Stack
Empty
48.Reverse Bits
Empty
49.Number of 1 Bits
Empty
50.House Robber
Empty
51.Number of Islands*******
TODO: UNION FIND
If you don’t want to modify array, use visited set. If don’t want extra space, make the visited on the grid to ‘0’ or ‘#’
52.Reverse Linked List
Empty
53.Course Schedule
Empty
54.Implement Trie (Prefix Tree)
Empty
55.Course Schedule II
Empty
56.Add and Search Word - Data structure design
Empty
57.Word Search II
Best soln, one submitted 6/4, best for time and ease to implement
58.House Robber II
Empty
59.Contains Duplicate
Empty
60.Invert Binary Tree
Empty
61.Basic Calculator II
Empty
62.Kth Smallest Element in a BST
Followup:
add self.numLeft = #values in left subtree + node itself
start at root.
if root.numLeft == k: return root
if root.numLeft > k: root = root.left
if root.numLeft < k: k - = root.numLeft; root = root.right
63.Lowest Common Ancestor of a Binary Search Tree
Empty
64.Product of Array Except Self
Empty
65.Sliding Window Maximum
Empty
66.Search a 2D Matrix II
Empty
67.Valid Anagram
Empty
68.Meeting Rooms
Empty
69.Meeting Rooms II
Also 2 ptr solution
70.Graph Valid Tree****
TODO: Union Find
71.Missing Number
Empty
72.Alien Dictionary
Empty
73.Encode and Decode Strings
Empty
74.Integer to English Words********
MARKED AS 5 BC I DON’T WANT TO MEMORIZE IT RN
75.Find Median from Data Stream
Empty
76.Serialize and Deserialize Binary Tree
Empty
77.Longest Increasing Subsequence
Empty
78.Coin Change
Empty
79.Number of Connected Components in an Undirected Graph***
TODO: Union Find
80.Counting Bits
Empty
81.Top K Frequent Elements*****
TODO: QUICKSELECT!
- Min heap: O(nlog(k))
- Max heap: O(n + klog(n))
- Quick Select: O(n) O(n^2) worst
- Bucket Sort: O(n)
82.Sum of Two Integers
Empty
83.Insert Delete GetRandom O(1)
Empty
84.Pacific Atlantic Water Flow
Empty
85.Longest Repeating Character Replacement
Empty
86.Non-overlapping Intervals
Empty
87.LFU Cache****
TODO B/C Hard
88.Concatenated Words
OJ is fucked up, my TLE submitted 6/9 is correct
Could do top-down version, seems easy
89.Encode and Decode TinyURL
Empty
90.Subtree of Another Tree
Empty
91.Design In-Memory File System
Empty
92.Design Search Autocomplete System
Empty
93.Palindromic Substrings
Empty
94.Top K Frequent Words
- sorting nlog(n)
- minheap nlog(k) (complicated by python heap module)
- bucket sort + trie O(n)
95.Number of Distinct Islands
Empty
96.Flood Fill
Empty
97.Partition Labels
Empty
98.Most Common Word
Empty
99.All Nodes Distance K in Binary Tree
Empty
100.Snakes and Ladders
Empty
101.Reorder Data in Log Files
Empty
103.K Closest Points to Origin*******
TODO: Quickselect
104.Rotting Oranges
Empty
105.Path With Maximum Minimum Value
Empty
107.Minimum Cost to Connect Sticks
Empty
108.Longest Common Subsequence
Empty
109.Critical Connections in a Network
Empty
110.Search Suggestions System
Empty