There's a famous story about Gauss as a child (age 7 in some accounts) figuring out this trick when a teacher who probably wanted a break had the students add up the numbers from 1 to 100. He saw that you could combine numbers from the ends: 1+100=101, 2+99=101, and there are 50 pairs, so the answer is 5050.
Re:I cheated on my Microsoft interview (2019)
by SilasX on Sunday June 05, 2022 @04:59PM
(#31634793)
There's also the joke that John von Neumann was given this task and "cheated" by just instantly adding all the numbers in his head the naive way, without having to write anything down.
Re:I cheated on my Microsoft interview (2019)
by jacobolus on Sunday June 05, 2022 @05:39PM
(#31635081)
The traditional story is about calculating the distance a fly (or bird?) travels if it goes back and forth between two trains. https://jcdverha.home.xs4all.nl/scijokes/10.html#Neumann_4
Gauss was cheating since he was born! He fixed math errors in his father accountant stuff at age 3.(according to wikipedia) if thats not an unfair advantage i dont know what is ;)
Re:I cheated on my Microsoft interview (2019)
by MatthiasPortzel on Sunday June 05, 2022 @06:37PM
(#31635493)
> The only mistake the OP made was in acting like they hadn’t seen the question before
This. Everyone in the thread is claiming no wrongdoing on the part of the author. If I was in this position, I would excitedly inform the interviewer that I had seen the question before and then quickly write down the answer. But that would look be a lot less impressive than OP’s acting as he pretended to come up with the perfect answer on the fly.
Once I had a candidate struggle with my screening question, flattening an array of nested arrays, and that’s fine because I normally use that as an opportunity to see how they ask questions and work together on finding a solution. But the candidate went silent for about 5 minutes and then came back with a perfect solution, using iterators, which are a pretty obscure JavaScript feature. I later found that exact code block on the MDN site, and I was pretty shocked at how brazen an action it was, because if they had just asked for direction and admitted they were struggling they could have still passed the interview.