The Approach of Good Interviewees
Before we dive in, here's an important note. For any of this to work, you've got to have your data structures and algorithms down pat.
The more practice you have with these topics, the easier it will be to pattern
-ize them. It'll also be easier to retrieve them from memory come interview time.
A good starting point is, of course, AlgoDaily's Premium Course and daily newsletter problem. Other recommendations can be found in our lesson around How to Prepare for a Technical Interview.
With all that said, here's the typical steps we recommend for solving whiteboard questions. We'll spend plenty of time exploring each in depth.
- Run through a few (1-3) example inputs to get a feel for the problem
- Unpack the brute force solution quickly by asking how a human would do this
- Tie the brute force solution back to a pattern, data structure, or Computer Science technique
- Optimize and run through the same test cases from step 1 again
- If you have time, call out edge cases and improvements to the problem