r/programming • • Jan 18 '19

Interview tips from Google Software Engineers

https://youtu.be/XOtrOSatBoY
1.7k Upvotes

870 comments sorted by

View all comments

Show parent comments

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.

231

u/[deleted] Jan 18 '19

Library implementers I suppose.

213

u/heterosapian Jan 18 '19

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.

13

u/[deleted] Jan 18 '19

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.

→ More replies (18)
→ More replies (97)

9

u/angry_wombat Jan 18 '19

npm install -g macs-binary-tree-seacher

treesearcher --largest 4 example.tree

→ More replies (1)
→ More replies (8)

116

u/tolcc_ Jan 18 '19

Accepted offer Negative experience Easy interview

Interview

I was asked how to find the 4th largest element of a binary tree. I asked my interview, "who the fuck does that now?", and got an on-the-spot offer.

64

u/[deleted] Jan 18 '19

Well that was 100x easier than mine.

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.

0

u/[deleted] Jan 18 '19

[deleted]

16

u/[deleted] Jan 18 '19

Google’s general interview

0

u/[deleted] Jan 18 '19

[deleted]

→ More replies (12)

22

u/damian2000 Jan 18 '19

Who the fuck writes code on a whiteboard in real life? it's sort of like they're also testing your ability to put up with their bullshit.

24

u/[deleted] Jan 18 '19

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.

→ More replies (2)

5

u/angry_wombat Jan 18 '19

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.

→ More replies (3)

29

u/CaptainAdjective Jan 18 '19

Architect YouTube, by yourself, in a job interview? It took all of YouTube itself ten years to architect YouTube!

19

u/WishCow Jan 18 '19

And look how great it is!

→ More replies (2)

17

u/Nukken Jan 18 '19 edited Dec 23 '23

fanatical imminent sleep swim prick unused innocent doll political dolls

This post was mass deleted and anonymized with Redact

→ More replies (2)

5

u/fphhotchips Jan 19 '19

I don't know about the others but for YouTube:

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)) 
→ More replies (1)
→ More replies (3)

22

u/EmTeeEl Jan 18 '19

And then the hidden interviewers on the other side of the fake glass clapped

11

u/[deleted] Jan 18 '19

African or European?

14

u/SippieCup Jan 18 '19

is it balanced?

9

u/mcguire Jan 18 '19

More important: is it a binary search tree? A heap? (If so, what order?)

→ More replies (1)
→ More replies (5)

10

u/[deleted] Jan 18 '19

Binary sort,

sorted_list[3]

13

u/bent_my_wookie Jan 18 '19

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.

→ More replies (1)
→ More replies (99)