Live data from Hacker News

Google: 90% of our engineers use the software you wrote (Homebrew), but...

twitter.com

211–220 of 683 posts

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#211
post #191

To be fair, inverting a binary tree is a pretty easy question. Google also tells you BEFORE you start the interview process that it'll be very data structure/algorithm oriented and asks that you please prepare (and take as much time as you want doing so). They even say that they want you to prepare because they know a bad candidate that prepares can look better than a good candidate that doesn't prepare - then want a…

I am dismayed by the way all the reactions on Twitter are piling on with outrage and/or relating similar experiences.

Inverting a binary tree is pretty easy. It is not quite as trivial as FizzBuzz, but it is something any programmer should be able to do. If you can't do it, you probably don't understand recursion, which is a very basic programming concept.

This isn't one of those much-maligned trick interview questions. This is exactly the kind of problem one may have to solve when writing real software, and though you may never have to do this specific thing, it is very related to a lot of other things you might do.

I run a small software company and I very likely would not hire a programmer who was not able to step through this problem and express a pseudocode solution on a whiteboard.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#212
post #43

Earlier quoted context omitted.

These types of interviews work really well for the "I got 1600 on my SATs and went to {insert high profile school here} crowd" There are books out there just to prep you for Google interviews I see these as very similar to SAT test prep books. I'm not so sure Google is really interested in hiring the best engineers but rather a specific type of engineer.

Think of the problem from Google's perspective though. At some point, you have tens of thousands of candidates and you need a system to quantify how good they are. Further, it's reasonable to have false negatives (people you don't hire that should have been hired) but really bad to have false positives (people that you hire that you should not have). Together, these boil down into the de facto whiteboarding interview…

No, it doesn't.

Say I pass the invert a tree question. Does that prove I am good? That I can design a product, listen to customer requirements, come up with ideas that elude others, read a research paper and turn it into something commercial, solder a circuit board, make a schedule, mentor junior engineers, write documentation? No. All inverting a tree tells them is I studied trees recently, and/or I'm at least superficially clever.

Google lets go of plenty of people. They aren't making perfect hires.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#213
post #61
post #3

Interviewing is stressful and all, but if the guy's reaction to not getting hired is to flame on twitter, not hiring might've been the right call.

Why? He's under no obligation to Google. It's not like they hired him and he has to sign an NDA or be polite. He had a frustrating interview process and vented about it online, it's a pretty human thing to do. Why would that make him a bad employee?

Well, not that I agree with the sentiment, but corporations likely have incentive to hire individuals that are easier to push over and keep quiet as long as they have the skill set needed.

If you were a corporation trying to keep PR positive, would you hire someone that has shown themselves as an outspoken public mouthpiece and tip-toe around them to keep them happy, or just avoid the problem?

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#214

Earlier quoted context omitted.

"they can afford to have strong filters which will definitely filter out a bad hire, may be at the expense of rejecting a good candidate" Can they, though? Obviously they believe they can, but are they correct? Google's not going away any time soon, but they could easily slip a long way down from the top of the heap. There are signs that's started to happen. I don't think they can be nearly as casual about losing top…

In the long run, this could affect Google, but, then again, if they change their hiring policies for better even after long 5 years, the best talent that might had been rejected before would still go to work at Google. So, still I don't think Google really consider it as an issue for them. Though, I have been burned once myself by them.

I don't consider myself "top talent", so I won't comment on my own experience through the interview process. But I do know that I don't want to work for google. Hell, I'm happier doing my own thing.

I also know a few "top talent" engineers that rejected the google offer because they didn't like the process and the people they met. I know even more ex-Googlers that quit within the year of starting there.

It's not an issue for them? From where I'm looking, most of the experienced top talent (that it's not working at google already) is keeping away from it, in greener pastures and most won't look back.

Yep, google is not going anywhere anytime soon, but I'd be just a bit concerned if I were them.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#215
post #83

Earlier quoted context omitted.

If you rate engineers on their ability to memorize something they could have looked up on Google in 5 seconds, what are you really actually testing? If you're not at Google's scale, a take-home test that involves them producing a working solution to a problem in their own time, that you then expect them to be able to discuss, reason about, justify, and so on is a much better tool; even at Google's scale, where you mi…

Honestly, is reversing a binary tree something you need to memorize? I assume that's what he/she means by "invert".

Rambling weirdness stream of consciousness, but, yeah you might well be right... how hard can it be to reverse a binary tree? Isn't the "real" solution to sound out the solution as you go, and let the interviewer know what you're thinking?

I've never attempted to do this before, and my compsci is real weak, to the point where I'm going to make an educated guess about what a binary tree even _IS_ so... Let's start with what is a binary tree? Presumably we have a tree where every node has zero or two child nodes. Clue is in the name. In fact, that's an implementation detail, so let's say we have a tree where every node has a place two hold a left and a right node, where either can be null. Guessing that in order to be useful, the nodes need to hold a value. We need to choose a language here, and I know a miniscule amount of Go, and surely the cool kids at Google like Go, so:

    type Node struct {
        Value int
        Left *Node
        Right *Node
    }
And so now we can do something like:

    n := Node{ Value: 50, Left: &Node{ Value: 30, Left: &Node{ Value: 10 } }}
    n.Right = &Node{ Value: 80 }
Now what does it mean to "reverse" a binary tree? Are we simply swapping all Left values for Right values? It feels a bit like there might be a trick here. So let's draw a binary tree with some numbers, and think about what reversing it might look like:

           Input                    Output

            50                        50
        40      60                60      40
      35  45  55  65            65  55  45  35
Actually, that looks pretty reasonable to me, and that's a straight flip of each Node's pieces. I had wondered if I might need to only swap at every other depth, but this just looks like simply swapping over the left and the right branch will work fine.

We can either iterate or recurse here, right, because it's a nested data structure, and I once read almost the first two chapters of SICP, and I'm pretty sure those are the options. So, let's have a quick think about the memory / performance implications of that. I cannot think of a way we can avoid visiting each node here; perhaps there is one, but cards on the table, I can't think of one. So let's assume we have a runtime cost that will grow linearly with the number of nodes. If that's the case, I'm pretty sure that's what the cool kids call O(n) - maybe that's O(1), but I'm sure Wikipedia can tell me.

So the mechanics of switching any given Node looks pretty easy:

    nr := n.Left
    n.Left = n.Right
    n.Right = nr
That should handle nil no problem too. But we also have to switch the children. If my original assumption about having to talk to every node is correct, what the question really wants to do is know if we can do this in a way that isn't too much of a memory hog. Now a simple recursive method would do this, for sure:

    func (n *Node) recursiveReverse() {
        nr := n.Left
        n.Left = n.Right
        n.Right = nr
        if n.Left != nil {
            n.Left.recursiveReverse()
        }
        if n.Right != nil {
            n.Right.recursiveReverse()
        }
    }
But while I know _NOTHING_ about how Go's callstack works, I bet it doesn't do magical optimization to stop it simply growing and growing and growing, which I think the cool kids call "tail optimization". At this point, one turns to the interviewer and says "How big do these trees get?", and makes some point about simple and elegant solutions to problems that make developers lives easy, because hardware and processing power is cheap. Let's assume the interviewer doesn't let you off the hook so easily...

Let's take a second to think about the memory consumption of what we've got here. At the moment, we add a new ... thingy (are they called frames? I have no clue) to our callstack for each child, and our worst case scenario then is the maximum depth of the tree. No-one has told us if our tree balances, but I suspect that if it does, you could then describe the max-depth using a formula involving `log` and the total known nodes. Wikipedia would know.

What else could we do? You could keep an explicit stack of nodes you knew you still needed to be visited, and go depth first. My gut feeling there is that you could write this where you get a worst-case scenario of your stack getting as big as the deepest node, plus one or two. If you wanted a truly iterative approach, you would need to store a pointer to the parent in each Node; there's a memory (or storage) cost to that too, so how often do we actually need to reverse the binary tree? That's a question to think about.

Given all this, then, one comes down to: what's the relative memory pressure that each frame in the call stack exerts, as opposed to pushing a pointer on to the end of an array in Go? Oooh, Go arrays are immutable, so actually you need to think about slices, unless you already know the size of the tree, and can preallocate exactly as much memory as you need. I wonder if there are memory implications there? With my commercial hat on, again, how much does this actually need optimizing?

Anyway, those are the considerations that come to mind; it would be worth checking Wikipedia for a nice iterative approach here, or if there's a sensible known algorithm. I'm going to stick with the recursive version I had above as my whiteboard version.

Did I get the job?

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#216
It seems that google wants to have code monkeys instead of creative software engineers. This is a common problem of big companies. IMO it is one of the reasons they get stuck with innovations. Of course also the interviewers don't want to hire people which are smarter than they are because of their own career.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#217
I, for one, agree with this kind of hiring process.

From my own experience - people that do well in such interviews are good generalists. On their own they will start discussing performance improvements and ways to parallelize the solution, it's a pleasure to have such an interview.

It's about enjoying problem solving and willing to keep your brain fit. It has nothing to do with memorizing solutions to some existing set of problems.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#218

To all of those saying ranting on twitter is the wrong move I couldn't disagree more. Twitter is often the ONLY tool that the average person can use to communicate and/or call out large companies on their actions. This is BS and should be made known. Homebrew is an amazing tool and I'd be falling over myself getting the offer papers in this guy's hands if he came to me looking for a job. The fact that google turned h…

Ranting on twitter is fucking awful. All it gives is nuance-free soundbites, and there are no 'lines to read between' due to it's brevity. Stuff gets taken the wrong way or out of context all the time.

One of the reasons why it's so powerful is because it gives lazy journalists a stream of easy reaction quotes. When else in the history of journalism has there ever been a private company that was so heavily promoted, regardless of the media source? And even then, the react quotes are poor quality, single-sentence shit.

This rant on twitter is absolutely meaningless unless you have a heap of context to go with it. And because twitter is popular, it's dumbing down public discourse along with it.

/rant, that I couldn't have fit in 140 characters.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#219
post #70

Has no one stopped to question what Google may have been looking for in a candidate? The OP has written some great apps, sure, but there is a huge difference between writing a package manager for Mac (among other Mac/iOS apps and utilities) and writing incredibly complex, highly performant algorithms for say search indexing, machine learning, ai, etc... In that context, knowing CompSci basics like Binary Trees (usual…

There is no slander in his tweet, he reported the FACT, may be a tad-bit dramatic, but FACT none the less. I just cannot understand why people think, Job seekers should cower down in public in fear not getting a future offer. To the hell with it, speak your mind, live like a boss even it means you make a little less financially, its better than being a rich coward.

Re: Google: 90% of our engineers use the software you wrote (Homebrew), but...

#220
post #203

Earlier quoted context omitted.

the tweet is made to trigger that discussion. but you can rephrase the tweet to something like: even though I made a popular tool, I didn't get a job at Google because I'm not good at other things they need. Google probably has a lot of factors counted into the final decision, including algorithm skills, other software engineering skills, human skills, contributions to open source projects. It's never 1 reason why yo…

because I'm not good at other things they need. It's not that you're not _good_ at it, but you're not able to demonstrate under time constraints, lack of references, lack of iterative code/compiler/REPL feedback, and while being stared down by someone whose default mindset is "why am I wasting my time on this person?" It's never 1 reason why you get rejected, it's the total score. That depends on how far down the int…

demonstrate under time constraints, lack of references, lack of iterative code/compiler/REPL feedback

well that is the interview. for you being good means to know how to invert a binary tree if you have access to a compiler and internet, but for Google it means to know it off the top of your head. they could let you have access to compiler and then make the questions much more difficult. which one is better? I don't know. first one takes less time at least.

Often they'll cut you off at a phone interview if you stumble

I'd guess that's because they have so many condidates to pick from.

Post reply on HN