3 ms·
In general I don't do well on interviews because I get nervous. Having said that, for this specific case, 3 hours seems like a lot of time. All you have to do
by Maro 4y ago
In general I don't do well on interviews because I get nervous.
Having said that, for this specific case, 3 hours seems like a lot of time. All you have to do is find a similar command (probably the increment), trace it in the code (possibly with a debugger and some breakpoints), and copy/paste to add the funcionality for the multiply. Then, see if it compiles, it won't, and keep repeating until it compiles. Then, see if it works, it won't, and keep iterating until it does.
To be fair, in my first job 20 years ago I did this exact sort of thing for 3 years on a very large C/C++ codebase. Also, later when I was at Facebook I did this a lot in that humungous codebase (searching the codebase, finding the right place to make a change, looking for something in the neighbourhood that looks similar and can be copy/pasted).
So this interview question would be right up my alley.