Re:Ask HN: What sort of side-projects are useful for getting...
by Robin_Message on Monday January 23, 2017 @02:16PM
(#13464998)
I thought the trick with this one was to sum all the entries and subtract the sum of 0 to N-2. The remainder is the duplicate entry.
It's just a trick though; I don't think skill in coming up with these is particularly well-correlated with being a good programmer, and for that reason Google claims not to do teasers like this any more.
Re:Ask HN: What sort of side-projects are useful for getting...
by bdavisx on Monday January 23, 2017 @04:41PM
(#13466321)
If a company is relying on someone coming up with a trick answer, then they deserve the employees that they get.
Re:Ask HN: What sort of side-projects are useful for getting...
by gms7777 on Monday January 23, 2017 @02:40PM
(#13465228)
That works in the case where there is exactly one duplicate entry. The question says there is at least one dup entry.
Re:Ask HN: What sort of side-projects are useful for getting...
by serge2k on Monday January 23, 2017 @03:25PM
(#13465661)
> for that reason Google claims not to do teasers like this any more.
All google does is teasers like this.
Re:Ask HN: What sort of side-projects are useful for getting...
by orange_county on Monday January 23, 2017 @10:12PM
(#13468513)
To be fair, the level of depth one person knows about algorithm was a lot less back then.
Today everyone is reading CTCI book and prepping. So if you aren't at that level, you will be behind. It's just like that guy who refuses to use steroids while trying to be competitive in MLB/NFL.
If Donald Knuth interviewed with Google, he would fail too because he would need 24 hours to solve a hard level leetcode question[1]. Unfortunately, Google loves throwing those kind of questions at interviewees and expect them to come up with solutions within 1 hour interview, lol.
[1] - http://keithschwarz.com/interesting/code/?dir=find-duplicate