Thanks for sharing your story.
First of all, I hope you're not still worried that you'll never make it as a Software Developer. Most people I know have failed these kinds of tests. to be honest, I failed one pretty spectacularly about 8 years ago.
You are spot on with your advice. One thing I stress is to keep calm. Don't expect to be able to instantly solve any problem. Sit back, relax, and think about the "moving parts" of the problem. Then simply start talking about it. Ask questions. Model your thoughts on the whiteboard. If you start to see part of a solution, start talking about it. Normally these types of problems have specific twists that make them a bit harder. Start by ignoring that twist. Explain to the interviewer that you want to get some of the core mechanisms working first before tacking the harder problems.
In this case, I put myself into the interview position and started talking to my wall. the first thing I thought was "this is effectively an 'interleave' function with a couple of twists (reverse the second array, keep track of the longer of the two arrays, etc). Then I started solving the simpler problem on paper. My first attempt got thwarted and I scratched it and tried again. I didn't worry about trying to make the code really nice and clean - I just started by keeping a couple of variables as pointers into the A and B arrays and then did a simple for loop. I got the answer right after about 5 to 10 minutes. The important thing to remember is that if I was being interviewed, I would be talking the whole time. Basically, I'd be making light of the situation, having a laugh, being calm.
Anyway, I could keep talking but should wrap this up... Good luck! Work hard, keep learning. You'll make it.
Thank you for advice, hopefully I'd be able to apply everything you said in my next whiteboard interview.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.