Hey folks,
I just finished Alex's Master The Data Structure and Algorithms Interview course. One question stayed with me when Alex went into how important it is for discussion on edge cases and alternate approaches in the Getting To The Next Level section. If we know that the interview will last for another x minutes when we get the coding question, which one of these options should we take?
1. Completely go berserk with edge cases and alternate solutions that you can potentially think about - and have an engaging discussion with your interviewer about the tradeoffs associated with each of the approaches, to the extent that, the interviewer does not care to see you write code (they conclude you're a DSA ninja)
2. Just take the x minutes to limit your scope, write your plan, and write the code.
I think option 2 is more prudent if x <= 25 minutes but otherwise, I will go with option 1. Having said that, I know Alex talks about folks who did this when he was the interviewer. Was this for x > 25-minute durations too?
Thanks!
Alex can share his opinion when he's back from his Japan trip, but I think the answer here will depend on the signals you're getting from the interviewer.
As Sophie mentions in our discussion about system design (but is still applicable to DSA problems), a really smart technique is to propose what you're about to do and then ask "How does that sound?" at the end.
This gives the interviewer the option to interject if they feel like you're spending too much time on edge cases or too much time on the happy path.
I agree with you that option 2 is probably better if you are strapped for time. The max signal the interviewer can get from you is if you actually start writing code (option 2), not just discuss all the approaches.
Beautiful! Love this! Thanks, Rahul - Sophie makes some great points too!