6 Demonstrate Debugging Skills
有bugs是正常的,我面试里面,从来没有一次是一遍过,除了2sum lol。
但是每次有bug我都会说”ok, let’s try to debug this, let’s add a print statement here blahblahblah”
一顿操作下来把bug找出来,修好,这就把一个有bug的bad sign转换成了”candidate debug能力很强”的good signal
7 Test your code. 1point 3acres
写完题代码大概自己觉得对了之后,写几个test case,各种情况正面反面都test一下。
我有一次面试完后写了非常complete的test cases,正面反面90%的情况都枚举了一遍,最后面试官很开心地说”Nice! I m confident that your code will work!”。这种时候就很明显这个面试已经pass了。
有的candidate写完题后就跟我说, “ok i think this code would work”,
我心里一般会想 你咋知道。。嘴上: “nice! Let’s write a few test cases to see, let’s start with the example test case we had”
写完代码不主动写test case测试的,也是一个red flag,特别是我不确定你的代码真的对的情况下。