Live data from Hacker News

Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

news.ycombinator.com

171–180 of 206 posts

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#171

I am a SWE at Google, and yes, most Googlers are pretty good at solving whiteboard problems. It's not like we are born with those solutions in our heads, but we enjoy solving those questions especially with other people. It's a lot of fun to "explore" answers to these questions, and that's what I think interviews are all about. I know HN hates whiteboard problems, but just like anything, you get good with it if you'r…

I also want to see how you guys solve these problems. People on youtube videos already know the answer. They just told you how to solve it. But I can't see how they approach to get the answer. I think that part is the most interesting and valuable part for non-talent like me.

In my experience, you can't learn that skill by watching others. It is a practice, like playing chess, or writing Math proofs. So IMHO the only way is to train. Start with simple problems, and continue from there. Bang your head against problems for a few hours before looking up the solution. Over time, you will get better.

Disclaimer: I'm myself not very good at algorithmic puzzles. For a job application I took a vacation to train solving coding tasks, and was getting better every day. I got that job, but guess that for a Google application I'd rather have to train for 3 months.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#172
post #166

Earlier quoted context omitted.

> if they're too hard they can never be solved in 45 minutes, again yielding no useful information I strongly disagree with the assertion that you get no useful information from an unsolved problem. The goal of giving a candidate a problem should not be to have them solve it. The goal should be to learn how they approach a problem, think it through, and work on solving it. Actually coming up with a solution is the le…

> As an interviewer I've intentionally given people problems that would take more time than they have What are your experiences with this? I've thought about doing this but decided against it because I figure the candidate's anxiety and stress levels are already high enough without the knowledge that they've been given a problem that's impossible for them to solve.

It works well when you set proper expectations. I make sure they know they are unlikely to finish and that we're doing it to learn their process, not the solution.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#173
post #64
post #44

Earlier quoted context omitted.

I should have said "n log n heuristic approximate solution" (my defense: I'm actually a biologist pretending to be a computer scientist). Many problem solutions at Google are effectively heuristic approximate solutions to NP-hard problems (or less hard but interesting problems). There's no trick, they just want to know you can figure out how to compute things quickly so they can run online in a server or a batch job.…

But I suppose appropriate heuristic solutions are typically only "pondered about" and not "found" at the whiteboard, because they require extensive testing with real-world data to see if they are actually efficient in practice.

No, that's not necessarily how it works.

Often (most?) of the time, heuristic solutions are also found by Complexity Theorists, and they usually can prove that their solution is efficient for problems with certain characteristics, e.g. random data, not random data in a particular way, etc. These are then applied by the industry when they come across problems with these characteristics.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#174
post #160

Earlier quoted context omitted.

I mean I'm surprised you don't see why this question is plain stupid. I've had to deal with an algorithm problem of this difficulty once in my entire work life and I was given a week time to go figure out the best way to go about this. Your problem creates an unrealistic standard of a software developer. You don't get to see something like their coding quality which is a lot more important in a candidate than their a…

>>I mean I'm surprised you don't see why this question is plain stupid. Its more psychological than technical. Once a person knows how to do a thing, they start to think any one who doesn't, is stupid. Their intelligence becomes the baseline to measure others intelligence.

I agree with this.

My question always is why do you think this is important for the position you're hiring. Does knowing this question mean they're actually good for your position?

This is turning into the situation I've seen in places with serious entrance exams for universities. For example in Iran, a lot of not so talented but have great memorization and afforded to do mindless practice exams are making it into higher education while creative and talented and less fortunate people are staying out.

There are entire businesses built around practicing algorithm questions now, this is not a good sign.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#175
post #2

I work for Google and have never been good at the "Here's an NP-hard problem you haven't heard of, write correct code for nlogn solution on whiteboard in language of choice" question. I had to train extensively (reading CLR, practicing) to be able to pass. However, large numbers of engineers at Google are very good at solving whiteboard questions. A lot of it comes from practice, a lot comes from knowing the common p…

> I had to train extensively (reading CLR, practicing) I didn't know what "CLR" was, so I searched around: Cormen, Leiserson, Rivest's "Introduction to Algorithms" [1]. [1] https://en.wikipedia.org/wiki/Introduction_to_Algorithms

Common Language Runtime!

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#176
post #36

I work at Google and no it's not easy for us either. I've heard many of my coworkers joke that if they went through the interview process again they'd probably fail. That said I see two kinds of interviewers. One kind (the good kind) takes a medium difficulty question and uses it to explore the candidate's coding, algorithms, communication, and problem solving skills. The other kind has a super hard question with a s…

Working at FB, +1 to all of this. Personally I find that I can get a lot more useful signal from simple practical problems (eg "take a .txt file as input, modify all the words which contain the letter 'q' to be uppercase, write the results to a new file") which have a lot of room for expansion (What if we instead want to capitalise each word where the word after it contains a 'q'? What if we only want to modify the t…

What would the correct solution be for the questions involving an input too large for RAM? This is new to me.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#177
post #101

Earlier quoted context omitted.

I also work at Google and what mystifies me when I do interviews is just how consistently people manage to screw up even the medium difficulty questions. I used to love asking this question until it was banned: https://programmingpraxis.com/2012/01/20/knights-on-a-keypad... This is a great question because it has several levels of solutions: 1. A recursive solution that iterates over all sequences, exponential time a…

>A logarithmic time solution involving adjacency matrices, matrix multiplication, and binary decomposition of numbers. can you post a link to this solution? sounds cool. edit: lol i just realized this is simply multiplying the adjacency matrix and what you mean by binary decomposition of numbers is just exponentiation by squaring. it's funny now that i realized i'll probably never figure out the dp solution. edit2: g…

Yeah this is one of the "standard" uses for matrix multiplication. Another one is calculating the N-th fibonacci number in logarithmic time (or any linear recurrence).

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#178
post #101
post #36

I work at Google and no it's not easy for us either. I've heard many of my coworkers joke that if they went through the interview process again they'd probably fail. That said I see two kinds of interviewers. One kind (the good kind) takes a medium difficulty question and uses it to explore the candidate's coding, algorithms, communication, and problem solving skills. The other kind has a super hard question with a s…

I also work at Google and what mystifies me when I do interviews is just how consistently people manage to screw up even the medium difficulty questions. I used to love asking this question until it was banned: https://programmingpraxis.com/2012/01/20/knights-on-a-keypad... This is a great question because it has several levels of solutions: 1. A recursive solution that iterates over all sequences, exponential time a…

How would you rate this solution? Assuming we have static keypad grid.

  long moves(int start = 1, int len) {
    assert(len > 0);
    long[] cur = new long[10];
    for (int i = 0; i  0) {
      nxt[0] = cur[4] + cur[6];
      nxt[1] = cur[8] + cur[6];
      nxt[2] = cur[7] + cur[9];
      nxt[3] = cur[4] + cur[8];
      nxt[4] = cur[3] + cur[9] + cur[0];
      nxt[5] = 0;
      nxt[6] = cur[1] + cur[7] + cur[0];
      nxt[7] = cur[2] + cur[6];
      nxt[8] = cur[1] + cur[3];
      nxt[9] = cur[4] + cur[2];

      for (int i = 0; i 

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#179

Earlier quoted context omitted.

Working at FB, +1 to all of this. Personally I find that I can get a lot more useful signal from simple practical problems (eg "take a .txt file as input, modify all the words which contain the letter 'q' to be uppercase, write the results to a new file") which have a lot of room for expansion (What if we instead want to capitalise each word where the word after it contains a 'q'? What if we only want to modify the t…

What would the correct solution be for the questions involving an input too large for RAM? This is new to me.

"the correct solution" implies that there is one particular correct solution - there are a lot of options, and I'd accept any answer if the candidate can come up with a reasonable justification for it. One example would be to process the data in fixed-size chunks of eg 1KB instead of trying to process the entire file at once. Pros: no matter how weirdly malformed your data is, your memory use is constant. Cons: what if that 1KB boundary line cuts a word in half? - then the candidate can either handle that new edge case, or switch to a different approach that doesn't suffer from that problem. Again, either option is valid if they have a solid explanation for what they are doing and why they are doing it.

Re: Ask HN: Can engineers from Google or Facebook solve whiteboard questions easily?

#180

There is a great video lecture where a guy talks about how tough his committee was, and they denied a series of packets only to be told that the packets were theirs! Very reassuring.

https://youtu.be/r8RxkpUvxK0?t=536
Post reply on HN