Don't do another coding interview... Until you've mastered these 50 whiteboarding questions.
—Sam Gavis-Hughson, founder of Byte by Byte
You can subscribe these problems from here. Really appreciate it to Sam.
Learn how to develop a systematic approach to each problem as follows:
Understanding exactly what is being asked is critical to your success. Ask any clarifying questions necessary. Look at the input and figure out how that resulted in the given output. If you see any obvious problem areas or edge cases, add in your own example. Based on the input and output, what should be the signature of your function?
The brute force solution makes you really understand the problem, and guarantees that you find a solution. Far too many people try to jump into an optimized solution and get lost. It's really hard to recover without simply starting over, and in an interview you definitely don't have time to start over.
Time to shine yourself. But you shouldn't spend more than 5-10 minutes on this step before moving on to coding. Try brainstorming more efficient data structures, looking at duplicated or unnecessary work, or just looking for more efficient solutions unrelated to your brute force solution.
Since you've done all the legwork, coding should be the easy part. If not, it's worth dedicating time to practicing coding, particularly on paper or a whiteboard.
This final step is critical. Not only does it show your interviewer that you're careful and thorough, it gives yourself the confidence that your solution is correct. Go through the code line by line. Missing small typos or indexing errors could leave a bad taste in your interviewer's mouth even if you did well otherwise.
- Median of Arrays
- 0-1 Knapsack
- Matrix Product
- Find Duplicates
- Consecutive Array
- Zero Matrix
- *Square Submatrix
- Merge K Arrays
- Matrix Search
- Merge Arrays
- Zero Sum Subarray
- Permutations
- **N Stacks
- Anagrams
- Random Binary Tree
- Lowest Common Ancestor
- Sum
- *Reverse Stack
- Tree to Doubly Linked List
- Longest Consecutive Branch
- Print Reversed Linked List
- Balanced Binary Tree
- Binary Search Tree Verification
- **Smallest Change
- Two Missing Numbers
- Bit Int Modulus
- Swap Variables
- Gray Code
- Rotate Bits
- Number of Ones in a Binary Number