Hacker News new | ask | show | jobs
by taesko 2399 days ago
I solved it like this: The numbers are x, x+1..., x+10 = 11x + 55. One is erased therefore 10x + 55 - y = 2012. 10x - y = 1957. We know X is whole so we need a number between 1957 and 1967 that divides 10 and that is X. 1960 so X = 196 and therefore y = 3. Answer is X+Y = 199.

I think a school student can do this math manually. The hardest part is the sum of the first N(in this case 10) numbers and then finding the divisor. Yes there might be a better solution.

But I think a kid would think up a brute force algorithm like this and it is easier for small N. The computation is only in O(N) complexity haha. And if an answer exists it will always be found - so it is a real solution. Might be the first algorithm you write if you are tasked to do this with software.