I keep hearing about having tests at the end to validate your algorithm at the end of a coding round. But I have found in the past that just getting the right implementation and then walking through it with an example input is sufficient. People are making it sound like they literally write unit tests and test methods, and test with multiple example inputs. I just find that extremely hard to believe, especially when in my experience, the interviewer is very excited when you have performed well and successfully implemented the correct approach, and they glance over verification/testing so that you have enough time to ask them questions so they can sell you on the role. For those of you claiming you must write out unit tests / test methods, what does that even look like for you? Can you provide an example in comments?
You don’t need to run through your solution line by line, but you should at least mention to the interviewer what you’re testing/concerned about and then run it through mentally.
It’s better to run line by line, not just for the interviewer but you may find genuine bug. When mentally checking we skip details.
If you can call out the edge cases you're anticipating ahead of time, they like that. Then you just verbally run thru those examples quickly and usually they move on cause there's a follow up question coming
Every on-site I have been from Twitter , LinkedIn , ByteDance recently all made me run code with multiple test cases , in all rounds
What do you mean multiple test cases. As in executing the code with different sets of input values to test against different edge cases?
Yep they made me write a custom code and provide different input and check my actual function output
Think of edge cases before your interviewer comes up with it and then walk it through your code. Recently received google L4 by following this
Do a mini proof by induction. Prove it works for case case, then prove given it works for previous case, it works for next case. Also pay lip service to nulls etc.
Wtf advices people are throwing here. Proof of induction, write UTCs, execute code.. wtf.. Just take 2 3 inputs as examples and go thru them..lol
Yeah idk where that came from... proof by induction is probably a bad move unless you're sure it's a recursive/DP problem. Even then it's possible to fall into traps if you're not careful
Tech Industry
16h
1553
Why doesn't OpenAI offshore and reduce expense by 80%
India
Yesterday
1450
Ideal indian parents
Software Engineering Career
10h
2087
L4 Google -> 45 interviews, 5 offers, AMA
Cars
Yesterday
758
People that ride loud motorcycles, what’s the motivation?
World Conflicts
Yesterday
770
Peaceful Protest Hasn’t Worked and Has Been Met With Aggression.
Instead of just a verbally walkthrough, execute your source code function with multiple inputs which would cover the edge cases.
Gotcha, that makes sense. But what if you can't compile/execute (as in Google Doc / notepad screen share)? That's fairly common in my experience.
Both FB and G don’t allow code execution, so this is garbage advice