1. Read back the question to your interviewer(s) so you all are on the same page.
2. Clarify the situation, and you doubts and whether you should assume anything
3. Things might have already started hitting your brain - so instead of uttering something not useful, think for a moment and form your explanation for the solution.
4. Take them through your solution - each and everything - what data structure you are using and why? what is time and space complexity? Could you do better?
5. Incorporate interviewer's feedback in your approach.
6. After they are satisfied with your solution start coding.
-
Don't waste their time and especially your time on brute force solutions (Just brief them about it - 30 secs)
-
Take zero if possible and only when if absolutely necessary (dead end situation)
-
Always think you have to get it merged in the production and people are ready to reject your PR.
Proper variable & function naming - absolutely avoid
s
,a
,A
or functions likesolve
,go
)Use the code space properly - cleaner
if
,for
,while
andfunction
blocks. -
If you have a solution in mind, you should be able to sing it like a song. Explain you thinking process (this is what they are interested in).
Take a moment, build the explanation in your head and tell them step by step - data structures involved, algorithm paradigm, time complexity and space complexity etc.