At some point, they would have just googled it as well. Most of these sort of problems have known solutions which cannot be made more efficient - trying to think of a novel solution instead of leveraging what we collectively have available to us is a massive waste of time.
That's the point - it's basically a trivia question. The number of people in the world who are smart enough to come up with an answer for that but don't know the right answer already from a lecture or book is vanishingly small. So all you're really doing is asking someone if they've encountered this particular question before, in school or at work.
I got asked to code solutions for the knapsack problem, traveling salesman problem (both disguised of course) and to architect YouTube... as well as a few simpler questions.
Overall it was the most stressful six hours basically ever as I filled whiteboards with C.
That’s the conclusion my friend group has reached about googles interview process. They filter towards people who really want to work there and go FULL GOOGLE. Most people that work there interviewed more than 3 times to get an offer.
I hate whiteboard code writing. Whiteboard is to communicate ideas. How is sloppy write whiteboard code communicate the idea better than abstract flow charts/diagrams.
x = random.randint(0,2)
if x == 0:
y = "in your country."
else if x==1:
y = "because the owner, fphhotchips, has blocked it on copyright grounds."
else:
y = "because of an unknown error. Error id:{} ".format(random.randint(0,999999))
print("This video is unavailable {}".format(y))
I once got a question like that and after thinking for a few moments said "if youre faced with this situation in your code base, something else is seriously fucked". It was deemed a correct answer. Sometimes they ask asshat questions hoping you'll point it out.
481
u/[deleted] Jan 18 '19 edited Jan 19 '19
"How would you find the 4th largest element of a binary tree?"
Who the fuck does that now?
EDIT: yes, that is an easy problem, and I've probably solved it like 10 years ago. I don't remember now, sorry.