Live data from Hacker News

Hacking a Google Interview - MIT's guide to Google interviews

courses.csail.mit.edu

1–10 of 43 posts

Re: Hacking a Google Interview - MIT's guide to Google interviews

#2
I've done the Google interview thing (had 5 interviews, got asked to do more, declined due to my wife taking another job), and I can confirm I had some (I think 4 or 5) of these questions.

In my interviews I generally started with a naive answer, got the good answer on my own and got to the best answer with some hints from the interviewer. They didn't seem to regard this as a bad thing.

At one point when I started working on the "better answer" straight after a "good answer", the interviewer asked me why. I confessed that it looked to be a similar class of problem to one in the previous interview, and he told me that was excellent.

There were two problems I did badly at. One was a math question (number theory), which I got after a bit of work. The other didn't really get anywhere with. It wasn't included in any of these linked items, either, so I guess I can't say much more about it. It was a fair question though.

Re: Hacking a Google Interview - MIT's guide to Google interviews

#3
They get the definition of polymorphism wrong, because their definition ("ability of one method to have different behavior depending on the type of object it is being called on / object passed by parameter) is also met by compile time function overloading. Their example, where you have a customer integer class that is capable of dealing with both other integer arguments and floats is pretty poor.

Any definition of polymorphism should at least mention something about the method that is invoked depends on runtime data, and is not resolved (or known) at compile time.

Re: Hacking a Google Interview - MIT's guide to Google interviews

#4
I realize the notes are for preparing a potential employee for a Google-style job interview.

I am curious if there are any employers out there with tips for follow employers about how to screen candidates.

I find that a vital skill is understanding good code design, that is, placing the responsibilities with the correct code, keeping dependencies down to a minimum, proper encapsulation of the complex stuff, separation of concerns, etc.

I recently hired someone who is a decent coder and problem solver, but I regularly have to “correct him” when he starts new submodules because he still doesn’t master the “design” aspect of coding.

That is, he might do some rudimental analysis about how to structure things and what the API should be, but if I don’t stop him, it always ends up being more complex than need be, and I honestly don’t think he knows how he could do it better, because it is really the same things I say to him over and over.

Since I will hire more people down the road and since I am tired of having to point out the same design flaws over and over, I am interested in tips for “testing peoples design skills” and also book recommendations about how to master big software projects without it ending up as tightly coupled components with arcane code — which sadly seems to be how most projects do end up…

Re: Hacking a Google Interview - MIT's guide to Google interviews

#6
post #3

They get the definition of polymorphism wrong, because their definition ("ability of one method to have different behavior depending on the type of object it is being called on / object passed by parameter) is also met by compile time function overloading. Their example, where you have a customer integer class that is capable of dealing with both other integer arguments and floats is pretty poor. Any definition of po…

Any definition of polymorphism should at least mention something about the method that is invoked depends on runtime data, and is not resolved (or known) at compile time.

I'm not sure that's always true. Or at the very least seems language dependent.

Re: Hacking a Google Interview - MIT's guide to Google interviews

#7
post #3

They get the definition of polymorphism wrong, because their definition ("ability of one method to have different behavior depending on the type of object it is being called on / object passed by parameter) is also met by compile time function overloading. Their example, where you have a customer integer class that is capable of dealing with both other integer arguments and floats is pretty poor. Any definition of po…

Broader definitions than yours are in common use. You might find this classic paper: http://www.is.pku.edu.cn/~qzy/plan/lits/FundamentalConceptOf... and this updated survey: http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf interesting.

Re: Hacking a Google Interview - MIT's guide to Google interviews

#8
post #4

I realize the notes are for preparing a potential employee for a Google-style job interview. I am curious if there are any employers out there with tips for follow employers about how to screen candidates. I find that a vital skill is understanding good code design, that is, placing the responsibilities with the correct code, keeping dependencies down to a minimum, proper encapsulation of the complex stuff, separatio…

Complexity can sometimes be a perspective thing. I recall a discussion at one point with a co-worker were we were each arguing that the other persons approach to a particular problem was more complex. After much contemplation I was able to see both perspectives.

Also with some problems there seems to be a conservation of complexity notion. It's inherent in the system and depends on where you push it.

For the book, you might want to check out Large-Scale C++ Software Design. Unfortunately it's at home so I can't crack it open and double check, but it seemed full of suggestions on structuring code and layout a large software project.

Re: Hacking a Google Interview - MIT's guide to Google interviews

#9
post #6
post #3

They get the definition of polymorphism wrong, because their definition ("ability of one method to have different behavior depending on the type of object it is being called on / object passed by parameter) is also met by compile time function overloading. Their example, where you have a customer integer class that is capable of dealing with both other integer arguments and floats is pretty poor. Any definition of po…

Any definition of polymorphism should at least mention something about the method that is invoked depends on runtime data, and is not resolved (or known) at compile time. I'm not sure that's always true. Or at the very least seems language dependent.

Yeah, Java doesn't do multimethods (i.e., method dispatch based on runtime argument types).

If Class X has two methods:

  void foo(Object i);
  void foo(Integer i);
then:

  Object test = new Integer(4);
  X x = new X();
  x.foo(test);
will invoke 'void foo(Object o);' based on the compile time type of test.

Java does do dispatch based on the runtime type of X - but it is quite limiting once you are used to having proper multiple dispatch at your disposal.

(caveat: not in front of a javac - this is from memory).

Re: Hacking a Google Interview - MIT's guide to Google interviews

#10
post #3

They get the definition of polymorphism wrong, because their definition ("ability of one method to have different behavior depending on the type of object it is being called on / object passed by parameter) is also met by compile time function overloading. Their example, where you have a customer integer class that is capable of dealing with both other integer arguments and floats is pretty poor. Any definition of po…

"Any definition of polymorphism should at least mention something about the method that is invoked depends on runtime data, and is not resolved (or known) at compile time."

I think the emphasis on runtime data is a mistake. It would be possible to imagine an static, OO language which has polymorphism implemented using static analysis - perhaps in limited circumstances.

(I agree with your point about their definition also being met by overloading)

Post reply on HN