2 ms·
Interesting article, but ironically the interviewee's solution is still incorrect at the end of his post. You'll notice that he only squares the first digit, an
by AndyD1st 11y ago
Interesting article, but ironically the interviewee's solution is still incorrect at the end of his post. You'll notice that he only squares the first digit, and then adds the second digit rather than squaring it.
E.g. when he calls (happy 97) it prints 88. However, that's 9^2 + 7, when in fact the answer is 9^2 + 7^2 = 130.