The steps below have helped me numerous times and I can attest to their ability to aid in landing that big job or internship! The interviewer will give you whatever technical question they have in mind.
Follow these steps and it should help reduce nervousness, maintain focus, and impress the interviewer.
Once you know you have a solution, finish explaining anything that wasn't covered in the earlier steps.
This is the time to introduce and explain your solution's runtime and memory efficiency, so that the interviewer knows you are aware of those restrictions.
This is when you want to think of edge cases, the general case, formatting, what are your inputs versus expected outputs...stuff like that. Now that our solution has a scope and some more meaning to it, we should come up with some useful example inputs to the problem.
These will help us explain our solution, test our ideas, and ensure our code works.
Which one do you think will make you seem like an ace problem solver to hiring managers?
Resist the urge to go negative—a problem-solving question may pose a truly tough challenge or dredge up a horrific past experience that you’d just as soon forget forever, but don’t let that affect your composure during an interview.
It is ideal in my mind that you create a few different examples.
Before you even start writing or thinking about any code, take your examples that you created, and solve the problem verbally.