
How to Ace the Google Interview: Ultimate Guide - samgh
https://www.byte-by-byte.com/google-interview/
======
quarkral
Strange, I have yet to meet a single Google interviewer who was looking for
perfect syntax during the interview. Last year I forgot the syntax for a data
structure, told my interviewer "something like this," and he just said "that's
fine." Got the internship later on. I even had one interviewer who was ok with
me writing out matrix algebra mathematically instead of using np.matmul and
all that.

~~~
jogjayr
As an interviewer, I can confirm that I don't care about syntax or whether the
program compiles if I'm convinced their solution and approach would work. I'm
also OK with candidates using placeholder helper functions or shorthand for
trivial things (e.g. null/undefined check in JS) if they explain to me
verbally what that part is supposed to do.

~~~
jefftk
I also interview software engineering candidates at Google (n=150) and while I
mostly agree, I do think there's some signal in whether a candidate can get
the syntax right. It's not a dealbreaker if they don't, but all things
considered someone who comfortably writes code all day is more likely to be
able to write syntactically correct code than someone who doesn't.

The main things I want to see, though, are: can you communicate well about the
parts of the problem that aren't clear to you? Can you analyze and compare
solutions? Can you figure out something reasonably efficient? Do you
understand your solution well enough to code it?

(Speaking for myself, not my employer.)

~~~
oarabbus_
> I do think there's some signal in whether a candidate can get the syntax
> right.

I know you're talking about software engineers, not data analysts, but:

select from <table> [oops... you're supposed to put an asterisk there]

select <column>, count(field) from <table> [holy shit... I forgot the group
by]

select <column>, case when <condition> then <result> else <other> from <table>
[oh man, case statements need to be terminated with an `END`]

select <columns>, from <table> [oh no... SQL doesn't like that comma before
the from statement]

select <...> from <table1> join <table2> table1.column = table2.column [This
is embarrassing, I forgot the `on` keyword]

select <stuff> from <table1> union <stuff> from <table2> [Jesus... I forgot to
type `select` after the union]

select <column>, sum(column2) over (partition by column3 between unbounded
preceding and current row) as cumulative_sum from <table> [dang, SQL doesn't
know which rows if I don't actually mention `ROWS BETWEEN`]

select <column>, count(case when <condition> then 1 else null end) as count
from <table> order by count desc having count > 1 [ahh that's silly, you can't
put your HAVING clause after the ORDER BY]

with cte_1 as (select <...>), cte_2 as (select <...>) cte_3 as (select <...>)
select <columns and aggregations> from cte_1 join cte_2 on <...> left join
cte_3 on <...> where <condition> group by <many columns> [Oh my goodness, I
forgot a comma after closing cte_2]

Now, perhaps this says more about myself more than anything, but I really do
write code comfortably all day, I'm glad my current employer, or any number of
the clients I've worked for, haven't had this philosophy (even when watching
over my shoulder waiting for results they need at the moment). I'd be
mortified if anyone ever dug up some of the atrocious things I've requested of
the database in the server logs.

~~~
tempguy9999
> > I do think there's some signal in whether a candidate can get the syntax
> right.

> I know you're talking about software engineers, not data analysts, but:

(inserts self-pwn car crash here)

I've done SQL for ~20 years and I'd say I'm good at it. I don't make as many
mistakes as you've described but I know exactly what you mean, and I'd never
hold that against you because I don't give a toss about mistakes that the
language will catch.

I've rarely interviewed others, but when I did I asked high-level stuff
approaches. I wanted to see if they could grasp the solution, not the physical
framework.

Actual example: you're given a large collection of words, which you're allowed
to pre-process - you have plenty of time to do this. Later on you are given
another word, how would you very quickly find all acronymns of that word?

(inerviewee programmer didn't get it, so I tried it on a non-programmer we had
around - she very quickly worked out you ordered the letters and saved them -
she didn't explain it clearly (to repeat, she wasn't a programmer) but in
programmer terms it was a dictionary with keys as the sorted letters and the
values as a set of the words).

In this case, would you employ the supposed programmer who didn't get it, or
the non-programmer who did?

Actual example: Show me how you'd represent an arithmetic expression using
objects, and how you'd evaluate it in an OO style (was after class hierarchy
of (op, leftexpr, rightexpr and .eval method. With plenty of time and pushes
in the right direction, he still didn't get it despite claiming good OO on his
CV)

(True story: to same guy who didn't get the OO expression question, I started
off with an SQL question. His CV said SQL was his strong point, so I gave him
an easy one: "explain to me what a left outer join does". He shook his head in
confusion "Never heard of it". Actually happened! I'm not even exaggerating!)

~~~
oarabbus_
>Actual example: Show me how you'd represent an arithmetic expression using
objects, and how you'd evaluate it in an OO style (was after class hierarchy
of (op, leftexpr, rightexpr and .eval method. With plenty of time and pushes
in the right direction, he still didn't get it despite claiming good OO on his
CV)

As a SQL guy who knows Python, but specifically just pandas/seaborn/numpy
(matrix/set operations rather than the underlying constructs which make
numpy/pandas possible), as opposed to a SWE with OO skills, could you point me
in the right direction to learn how this question should be answered?

>"explain to me what a left outer join does". He shook his head in confusion
"Never heard of it". Actually happened! I'm not even exaggerating!

I... I don't even know what to say here. That's absurd to me he would claim
SQL knowledge and respond with that answer.

My response would be "that is the same as a `left join`" (then I'd explain
what a left join was) and follow up with "I exclusively write 'left join' and
never 'left outer join' as my experiences with the DB/MS I'm most familiar
with (Postgres, Redshift, MySQL, MSSQL and a couple others) accept the `left
join` syntax without specifying `outer`".

~~~
tempguy9999
First up let me apologise for the abrasive and somewhat unpleasant reply I
gave to you. Not my best, sorry.

Ok, couldn't find a sample on the web so here's mine. It's not right for
brevity and because this is the first python code I've done in ~3 years, so
any criticisms welcome. Hopefully can get the formatting right

    
    
      # super.init omitted for brevity
      class Expession: # abstract base class
          def eval(): pass
    
      class Literal(Expession):
          def __init__(self, val): self.value = val        
          def eval(self): return self.value
    
      lit1 = Literal(8)
      print(lit1.eval()) # prints 8
    
      class UnaryExpr(Expession): pass # base class for unary expressions
    
      class Negate(UnaryExpr):
          def __init__(self, expr): self.expression = expr
          def eval(self): return - self.expression.eval()
    
      lit2 = Literal(13)
      neg = Negate(lit2)
      print(neg.eval()) # prints -13
    
      class BinaryExpression: pass # base class for binary expressions
    
      # Note that subclasses Add and Multiply have the same
      # __init__ code so I should hoist that into the BinaryExpression
      # base class but for clarity I'm leaving it in the subclasses
    
      class Add(BinaryExpression):
          def __init__(self, leftExpr, rightExpr):
              self.leftExpression = leftExpr
              self.rightExpression = rightExpr
          def eval(self):
              return self.leftExpression.eval() + self.rightExpression.eval()
    
      add2literals = Add(lit1, lit2) # 8 + 13
      print(add2literals.eval()) # prints 21
    
      class Multiply(BinaryExpression):
          def __init__(self, leftExpr, rightExpr):
              self.leftExpression = leftExpr
              self.rightExpression = rightExpr
          def eval(self): return self.leftExpression.eval() * self.rightExpression.eval()
    
      mult2literals = Multiply(lit1, lit2) # 8 * 13
      print(mult2literals.eval()) # prints 104
    
      # now let's make a complex expression, say (7 + 2) * (-4)
      # Doing this by hand but a parser would build this from that
      # string
      expr = Multiply(
          Add(Literal(7), Literal(2))
          ,
          Negate(Literal(4)))
      print(expr.eval()) # prints -36
    

Basically it's a tree of objects that you call eval() on the root, and these
recursively call eval down, then when they reach the bottom start returning
their subtree-calculated values.

Make sense?

Re. the left join, I abbreviated it. Full event was that there was 2
interviewers, me + other guy. I said to our interviewee, "what's a left
join?". Cue puzzled expression and headshake. My co-interviewer qualified that
for him: "what's a left outer join?", getting the response "never heard of
it". He claimed 4 years of sql on his CV. No job for you, matey.

This isn't rare either, worked at a recruitment office and overheard a
conversation which recruitment agent used to check applicant wasn't clueless.
Applicant was applying for C++ job. Q: "give me 4 STL containers". Applicant
replied "cin and cout".

If you've done no C++ that's like asking a python guy "give me some python
data structures" and getting back the reply "input() and print()"

Edit: to clarify about the expression eval stuff, I wasn't expecting code,
just an obvious grasp of a tree of objects with relevant subtypes, and eval().
He knew roughly how to do it procedurally, but blatantly had no clue on the OO
style (which, yes, he claimed to have on his CV).

Incidentally, I'm just starting my very first step into Pandas today. Looks
SQL-ish!

------
retiredcoder
I interviewed with Google NYC for Senior Dev position once, prepared well and
thought it went well.

Received the green light and moved to the next phase, where I spoke with
potential teams over the phone, then settled with Google Maps. Met with one of
their Tech Leads, cool. I was really happy and though that all my effort to
prepare for the “Google interview” had payed off.

Then no word back from the recruiter with a final offer. It turns out the VP
of eng saw some red flags in my interview and decided to bail.

I felt really frustrated and while I spoke I spoke with the recruiter he
apologized and even said the hiring manager was on my side and people overall
liked me but there were two engs that were on the fence. Gosh, I think I met
with 7-8 engs, all the seniors seemed to like me. I remember not having the
best conversation with 2 engs who were new to the company and could not relax
nor communicate well.

Bottom line, prepare but also be prepared for some degree of luck and
arbitrary judgements.

Yes, there are great interviewers in google. Engs that are engs in their minds
and hearts, who can see the process is not perfect but work to get it better.
But unfortunately, there are insecure folks who should be better trained for
before interviewing candidates.

That was 5 years ago, not sure I would subject myself to this sort of loop
even again. And strange enough they contact me few months after to reinterview
but this time I could skip the big loop and meet with just 3 engs... I said no
since I was already in a new job.

~~~
segmondy
Sounds like the typical FANG experience.

------
_hardwaregeek
A friend said recently, "people want to be employed without becoming
employable". These guides really exemplify this obsession. Sure, Google has a
nice salary and good perks and whatever. But after you get the job, you have
to do the job. I wonder if the people who read these guides and try to study
just the right topics to get a job, whether they actually _like_ programming.

These guides act as optimizations, shortening the path you need to take to get
the job, shortening the stuff you need to learn, etc. But in the end, the path
is all you get. If you don't like programming and if you don't like learning,
then are you really gonna like Google?

I suppose there's people who genuinely like programming who just need a manual
to teach them how to play the game. Lord knows I've practiced my fair share of
whiteboard problems when I'd rather be reading about compilers. But there's
something wrong about having to play a game to get the job.

~~~
akdas
> If you don't like programming and if you don't like learning, then are you
> really gonna like Google?

There are also many people who are great at programming, wh love it, who are
terrible at interviewing. After all, these are two related, but ultimately
different skills. You talked about it yourself in your last paragraph, ending
with:

> But there's something wrong about having to play a game to get the job.

Sounds like the fault is on the employer that makes you play the game, not on
"people want to be employed without becoming employable".

~~~
_hardwaregeek
Agreed, the fault is with the employer, but the people who are willing to
indulge this game by obsessively learning to play it don't help.

~~~
optimize
I mean, if you want to work at Google and the likes, you need to indulge in
the game right? And working at Google isn't just about the pay and the salary
- thats quite a shallow thing to say. Engineers there handle data of
astronomcial proportions, scale their systems every second to handle the ever-
growing traffic, innovate on solutions that are used by millions of people
around the world. I'd say, if you truly love programming and computer science,
thats a pretty sweet deal.

~~~
_hardwaregeek
The people who spend their days obsessively networking and practicing
interview questions are generally not the people who would find problems about
scaling to handle astronomical proportions of data interesting. The people who
find that interesting tend to spend their days reading about scalability and
performance. I'm not talking about someone putting aside a few weeks to a
month to study up on these questions, I'm talking about people who straight up
neglect their CS education because they want to pass a technical interview.

------
RealDinosaur
The amount of time required to 'learn' the Google interview would be time that
could be spent learning more universally applicable skills.

Is it true that an experienced developer would not be able to pass the
interview without studying using a similar guide? If so, then the interview
process is... fubar.

~~~
CobrastanJorji
A perfect job interview could be defined as an interview for which the best
study technique is to become a better choice for the role. Studying skills
that would not directly contribute to job performance would not change the
result of a perfect job interview in any way.

In that sense, it's probably a good indicator for Google that the interview
advice includes "practice writing code", "make it a habit to validate input",
and "learn about data structures", and it's probably a bad indicator for
Google that the advice includes "practice writing syntactically correct code
on a whiteboard" and "practice solving problems with a 30 minute timer."

~~~
shaftway
I'm in the interviewer pool @ Google.

> practice writing syntactically correct code on a whiteboard

This probably differs from interviewer to interviewer as to how strictly it's
adhered to, but it's not really a hard and fast rule. I'm sure there are some
interviewers that will ding you on a forgotten semicolon, but I suspect that
most would not.

Personally I look for code that isn't so far from syntactically correct that
it's clear you are trying to BS me. I'll even accept pseudocode for the most
part. But I've had candidates that try to make up language features, and that
doesn't fly with me.

> practice solving problems with a 30 minute timer

I only give my candidates 30 minutes. The whole interview is 45, I spend 5
minutes introducing myself and setting up expectations, 30 on the question,
and 10 on answering their questions (after all, they're also interviewing us).

You can tell pretty early whether they're on a solid trajectory, and I'll
offer the occasional hint to keep someone on track, or ask tangential
questions if they're doing well on time. Not finishing isn't a deal killer,
provided you had a solid approach and weren't just running in circles. But a
good candidate will finish in about 25 minutes and we can spend some time
talking about alternate approaches. Sometimes I'll show them the optional
approach and see how that conversation goes.

Nine times out of ten a candidate scores low because they overlooked an
infinite loop or code would crash on boundary conditions and candidate wasn't
able to realize that even with hints.

~~~
CodeMage
> But I've had candidates that try to make up language features, and that
> doesn't fly with me.

This piqued my curiosity. Can you give an example?

~~~
justrudd
I'm still floored by how many candidates I've talked to that assert with great
confidence that the local variables they declare will still be there with the
same values when they call the function recursively.

And most recently, when iterating over a string's characters the underlying
string methods KNOW that the string is being iterated and will pick up at the
current iteration point. For example, you've got the string "5432112345". And
via iteration, you're currently pointing at the first "2" at index 3. The
candidate asserted that if you call "indexOf('2')", it would return 6 because
"indexOf" knows that it is iterating and should start 1 beyond where it is
pointing at.

And my favorite - once had a candidate that misspelled a function name while
coding in Ruby. I didn't ding them for it. But I pointed it out because it
just bugged me. And the candidate then swore to me that Ruby will
automatically call the correct method if there was only 1 candidate based on
the misspelling. You know when you do things like "git inti" and it says "did
you mean init?". The candidate swore that Ruby would just call "init" for you
because it knew what you wanted.

~~~
perturbation
[https://github.com/yuki24/did_you_mean#installation](https://github.com/yuki24/did_you_mean#installation)
:

    
    
        Ruby 2.3 and later ships with this gem and it will automatically be required when a Ruby process starts up. No special setup is required.
    

It doesn't call the method for you, but it does do the did-you-mean
automatically if you misspell and it's close enough.

~~~
justrudd
Maybe this what they meant? I dunno. I can see this being helpful in irb/pry.

In the end, we did end up making an offer to this candidate. They did well on
everything we asked them. This was the only "brain fart" they had.

------
matmann2001
This is getting ridiculous. These guides to interviewing at specific companies
are starting to sound like the video game cheat code books of old.

If the process is so nuanced that there's an entire industry around these
types of guides (and Google even highly recommends you buy them!), then the
process is fundamentally flawed.

But we already knew that, and as long as others are still playing the game, we
are forced to play or miss out.

~~~
ChrisCinelli
I completely agree.

Even Google suggest to "practice writing syntactically correct code on a
whiteboard". This is clearly a useless skill as a software engineers except in
getting a job at companies that do whiteboard interviews. Did you try to
refactor code on a whiteboard?

How are they able to find people that are able to efficiently debug problems?

When I interview people I tell them, "Bring your own laptop set up to be able
to code and debug". And I give them "Fix this site" or "build this thing" kind
of problems.

It looks like that it works a lot better to find "hidden gems" and people that
are good at "doing" instead of those that are jsut good at "telling".

~~~
bitL
Elite schools do that in undergrad; e.g. as an initial scored lab exercise,
write this recursive fractal shape using Logo, parallel Delaunay triangulation
with prefix sums , dynamic programming solving oligopoly problem or single-
value Paxos pseudocode on a piece of paper in 10 minutes (I am being serious).
If you can cope with it, it immediately shows up in the interview and you are
considered a member of the club, a person worthy of having conversations with.

~~~
peter_l_downs
Which elite schools? I went to MIT and didn’t have to do any of this.

~~~
chollida1
[https://courses.csail.mit.edu/iap/interview/materials.php](https://courses.csail.mit.edu/iap/interview/materials.php)

~~~
neilv
Just to add context: MIT Interim Activities Period (IAP) is a "winter break"
few weeks in which anyone can lead classes/sessions on any topic:
[http://web.mit.edu/iap/about/index.html](http://web.mit.edu/iap/about/index.html)

MIT CSAIL is the research lab joining of the legendary MIT AI Lab and MIT Lab
for Computer Science. People who work hard and win the lottery to do research
at CSAIL (or other prestigious lab) shouldn't afterwards be looking for entry-
level coding jobs for which a whiteboard code monkey dance interview/hazing
would be appropriate, IMHO.

(For different reasons, people who are in programmer career tracks, with
verifiable industry track records and/or open source involvement, also
shouldn't be put through the entry-level hazing. Claims that the ritual gives
certain companies metrics or somesuch would carry more credibility, had those
companies not been caught brazenly colluding, at the CEO level, to
systematically suppress wages and mobility of their own employees, with
presumed spreading market effects throughout industry.)

------
topicseed
It's also a good marketing milking cow to create paid courses and trainings
for Google interviews — the dream of so many novice devs and other "Intensive
Coding Bootcamp" participants.

Keyword research and trends...
[https://trends.google.com/trends/explore?date=all&geo=US&q=G...](https://trends.google.com/trends/explore?date=all&geo=US&q=Google%20job%20interview)

~~~
Frost1x
I'm semi-convinced this is yet another reason for perpetuating this type of
poor interview practice (not just at Google).

When you search modern interview topic and comments/opinions on the current
process, you'll find a few SEs (typically working at places like Google at
some point) on that on the side sell training bootcamps, etc. These people
will swear every direction that it's a reasonable process in comments around
the web referring to their side business. Creating problems they provide
solutions to: gatekeeping 101.

------
str33t_punk
I hate these style of interviews. I give them to prospective engineers every
week for one of these FAANGM companies.

They don't test for good engineers -- they test for people who practice these
style interviews, and for good new graduates.

It makes sense to ask these questions to new grads, but afterwards there is so
much more experience that I feel like is much more important than acing data
structures questions.

I am amazing at whiteboard questions, but that doesn't make me a good
engineer. It's because I found the trick to solving these, and have practiced
them. A lot of it it is practice 'ooo this looks like a graph problem, let me
use a graph', etc.

~~~
koala_man
Have you worked with any great, experienced engineers who would have had no
idea how to traverse a tree?

~~~
hypertext7
Yes, and those same great engineers went ahead and figured it out. You see,
some are hiring parrots, and others are hiring problem solvers.

~~~
koala_man
I'm all for hiring problem solvers, but how do you differentiate them if you
don't ask them to solve problems?

Years of experience is definitely not a guarantee of competence.

~~~
hypertext7
Hypothetical interview question: Write a function that finds the distance
between two words.

Candidate A: Can recite algos and remembers that Levenshtein distance is the
answer.

Candidate B: Has no idea what Levenshtein distance is, writes a brute-force
solution with the understanding that it's not an optimal solution. After the
interview she spends more time learning what she doesn't know, learns about
Levenshtein distance, and sends you an optimal solution via email.

The above is a real-life scenario, so my question to you is - how do you
decide who to hire?

~~~
koala_man
This is not a good interview question and neither candidate seems to have
answered it well, but I would reject B first because I obviously don't know
whether she did any research or whether she just asked Candidate A via
StackOverflow

------
shahbaby
These guides are just people trying to make a quick buck. There's no shortcut
to getting good and perhaps that's why these type of interviews are here to
stay.

~~~
soham
Amen

------
hnaccy
I've been trying to prepare and it makes me want to bang my head against a
wall.

Prepping while working is draining.

------
ssambros
> For the phone interview, it will be on a Google document, and for the onsite
> interview, it will be writing code on a whiteboard.

That part is not completely correct. At onsite can choose to write code in a
Chromebook which will have a lightweight editor with syntax highlighting.

~~~
oksurewhynot
It wasn't really a choice when I interviewed there. All but one interviewer
had me write code in the chromebook, which was my least favorite part of the
interview process. The trackpad didn't respond to my slightly dry erase
covered fingers, the keyboard was weird, and the quasi hangout software it was
running crashed a few times, one of which required a full restart. That might
not sound like a big deal but in a high pressure/time constrained environment
it was a bit of a nightmare. I was told going in that the chromebooks would be
available as an option, but writing a few lines of code only to be told to
stop and switch over to the chromebook (which had either gone to sleep or
frozen), have the interviewer log in and select the correct session, then
select syntax highlighting, then finally being able to start writing code
doesn't seem very conducive to maintaining a train of thought.

~~~
dmoy
Tell your recruiter, interviewers are not supposed to force candidates to use
chromebooks.

~~~
oksurewhynot
I thought about it, but the chromebook hang ups were not the deciding factor
in my performance (I did extremely meh and am fine with that because I'm
entirely self taught and to even get that far was really cool). There were
other larger problems with the process that google should be fixing instead of
dinking around with chromebooks (I'm assuming they were there so code could be
reviewed afterwards, which makes sense).

------
csnewb
Should be titled "How to Ace the Technical Interview in the Bay Area". Even
absolute shithole bottom tier companies or unknown startups are asking these
questions. Write perfect code on the whiteboard or get rejected. You have to
put in A LOT of time into preparation even if you don't want to work at
Google, which is ridiculous.

------
awiesenhofer
Genuine Question: Apart from maybe the money or a nice resume entry, why would
you/do you want to?

~~~
simmanian
I don't work at Google (and I don't agree with some of the things the
company's decided to do) but have many friends who enjoy working there. From
what I hear, Google has an organizational structure that is very favorable for
regular engineers. Once you're hired and you put in around a year of work in a
team, it's almost trivial to find another team. Engineers also directly
evaluate managers and I've heard stories of mid to high level managers crying
in bathrooms because of poor reviews from their reports. These factors combine
to create an environment where teams are actively working to make engineers
happy and content. Compared to many companies where managers make a lot of
decisions in a room with no feedback given to or received from engineers, it's
heck of a lot better.

~~~
6cd6beb
>I've heard stories of mid to high level managers crying in bathrooms because
of poor reviews from their reports. These factors combine to create an
environment where teams are actively working to make engineers happy and
content.

Honestly this sounds like a thought experiment.

Do you have any ethical hangups about entering an environment where falling
out of your favor can leave someone stress-crying in their place of work
and/or about their livelihood.

If so, how much money would it take for you to join the system anyway?

How long would you stay in such a system if you found yourself already in one?

Back in the real world, in a business context, it sounds like an abusive
workplace and an untenable system. Like, that obviously can't last forever.

~~~
simmanian
Perhaps using the crying manager example was a bad idea on my part. What I can
stand behind is having an org structure that encourages managers and execs to
treat their employees well. It sounds like Google has done a better job than
most. I'm sure there are managers and engineers crying in private in every big
company out there. What I'm trying to say is even though a lot of people like
to assume that people work for Google and stay there just for the money,
Google probably does some things very well to keep all the talent despite the
negative press it gets. And I think a major factor is how empowered a
"regular" engineer feels in the company. It sounds like a step up from many
other companies in that regard.

~~~
6cd6beb
There are at least two problems with this:

\- "I'm sure there are managers and engineers crying in private in every big
company out there": You're not excusing google here, just expanding the range
of companies whose apparent behavior is mortifying a couple of people in this
thread.

\- "Google probably does some things very well to keep all the talent despite
the negative press it gets.": probably. They probably do a lot of a/b testing
to dial in the compensation/retention ratio they're looking for, or maybe they
just heap rewards onto engineers because they can afford it. Be that as it
may, some people think that what google's doing is detrimental to society, or
at least the problems are bigger than a salary or even a total compensation
package should make up for.

~~~
simmanian
I don't see any problem because I agree with what you said. Work shouldn't be
so stressful that you cry in private. Google should do more "good" for the
world.

I still think Google stands as an attractive workplace for reasons that are
not just compensation and resume boost, though.

------
hermitdev
They lost me when they got into showing how to make the 'dups' function
faster. The author definitely either doesn't understand big-O notation or
doesn't understand the complexity. Their O(1) implementation is anything but.
Likely O(n×log(n)) at best. Also, their brute force implementation is
unnecessarily verbose. Want dups?

    
    
      from collections import defaultdict
      def dups(seq):
        d = defaultdict(int)
        for x in seq:
          d[x] += 1
        return [k for k, v in d.items() if v > 1]
    

Assuming Python's defaultdict has O(1) lookup/insertion (which I think it
does), this algorithm is a proper O(n) complexity.

~~~
cmurphycode
Hmm. I don't think they claimed to have an O(1) time solution, just O(1) added
space. Which, it is, but only because they're counting on the original array's
underlying type having enough bits for their sign flipping. It would be as if
you used a more compact type for the array elements, and then allocated
another bitmap for the range of numbers.

Of course, once we start optimizing how the original array is stored, we may
have exceeded the limits of this problem as a teaching exercise :)

As for time, it does seem to be O(n) to me; can you clarify why you think it's
nlogn? It may not be particularly fast in practice when compared to other O(n)
approaches like the bitmap, but I don't think the complexity is wrong.

Your solution is nice - it actually gives you more information (how many
appearances, not just T/F >1 appearance), but it does require more additional
space and isn't necessarily faster. I think the bitmap approach would be nicer
if you're ok with using more space; the bitmap is essentially a very easy to
find perfect hash function due to the unique input constraints.

------
pdonis
It would be nice if an article on how to ace a coding interview did not have
incorrect code in it. AFAICT the set-based algorithm for finding duplicates is
wrong; the resulting set will contain items in the list that are not
duplicated.

~~~
LVB
It doesn't work. Not just a coding issue either, as the code matches their
explanation for this "improved" method.

~~~
pdonis
_> It doesn't work._

Yes, I confirmed that by pasting it into the REPL and verifying that it gives
the wrong answer for a one-element list. Apparently the author failed to
follow his own advice to always test code that you write.

------
ArcMex
I wouldn't get an interview from Google even if I wanted to. I'm 29 and live
in Africa. That said this guide was still helpful. A reminder of some of the
skills I should hone for my next interview. I loved reading the comments here
because they give so much perspective from all sorts of people. HN is
extremely critical of everything and it can be sobering. I cannot obviously
speak about the intentions or damage such guides have or can do but honestly,
even if you know how to code, it doesn't hurt to prepare for an interview in a
way a prospective company would want you to.

------
Apocryphon
Question for hiring managers and employers:

In Silicon Valley, tech interviewing has become an arms race between
applicants cramming to pass tech screens and interviews, and employers coming
up with new routines. Sites like Glassdoor and CareerCup are loaded with
interview questions that have appeared in those routines, giving savvy
interviewees the opportunity to see the questions on the exam and prepare
accordingly.

How do you feel about the existence of these sites, and do they affect how
interviews are conducted?

~~~
shaftway
As an interviewer I don't really care. A good candidate doesn't need them, and
a poor candidate isn't helped by them. The only thing that's irritating to me
is that they actually burn interview questions. Once a question is seen on an
external job board it gets banned as an interview question.

~~~
Frost1x
In the current interview structure, I don't think that's inherently a bad
policy. It forces interviewers to develop new unique questions and hopefully,
while doing so, consider the cognative time and complexity the solution took
them before deciding to hand it to an interviewee.

This also discourages overly complex or overly familiarized questions. If the
question is too complex, chances are it will end up posted online soon after,
penalizing the interviewer in time cost. If a new question is recycled
frequently, it will also likely end up online at some point and penalize
interviewers from using questions they're overly familiar/biased in assessment
to based on their own rote learning.

------
PorterDuff
After a long and storied career I mostly just get a kind of vicarious doom-
thrill from reading about interviews I couldn't possibly pass.

------
AzzieElbab
Is it fair to assume "professional google interviewee" is a thing nowadays?

~~~
retiredcoder
Yes, I have a few close friends hopping jobs every 1-2 years. Part of their
secret is be involved with interviews to keep all this crap fresh in their
minds and also be part of this sub-industry of tech interviews.

Good for them financially maybe. Professionally, I didn’t see they go beyond
the average senior dev. But that just me being sour.

------
neduma
Seems like there are lot of sites like this in past few years. Great.

------
yegle
There's an unconscious bias in this post. Google as a company is not only
interviewing engineering roles. Even for engineering roles, there are too many
sub categories and many doesn't follow the typical SWE interview process.

If you just want to know what the interview for your roles would be, the
recruiter from Google will happy to give you an overview.

------
notus
Isn't the interview different depending on the job?

~~~
zhengyi13
My immediate reaction to the title of the article was "... for SWEs and
possibly SREs".

But to answer your question, yes, absolutely.

~~~
coleca
Any ideas what the process would look like for something like Solution
Architect for Google Cloud? I can’t imagine that there would be graphs and
tree coding questions but you never know.

~~~
simmanian
I think it largely depends on the person interviewing you. I know candidates
interviewing for Machine Learning positions get asked with typical algorithm
questions.

------
skookumchuck
I've never seen an interview process that HN (and Reddit and Slashdot and ...)
didn't trash as "deeply flawed", "biased", "unfair", "unreasonable", etc. At
some point, though, a company has to have some sort of process, and by and
large what they use works for them.

~~~
drivebycomment
It's always so much easier to criticize (as nothing is perfect) than actually
come up with a better solution in real life. So anything where there's no
perfect solution, people will endlessly criticize online, even though they
themselves have no better solution, and what they criticize is not terrible by
any means.

------
bitL
You can bypass the whole charade by knowing 2-3 people within Google that can
provide "assurance" you are good enough. Whiteboard testing is for
grunts/unknowns without network. Another way is to be a significant
contributor to some popular open source project.

~~~
seattle_spring
> You can bypass the whole charade by knowing 2-3 people within Google that
> can provide "assurance" you are good enough.

This is not a thing. Everyone goes through the same level-adjusted loop.

> Another way is to be a significant contributor to some popular open source
> project.

LOL no. Google is literally famous for rejecting major open source
contributors for not knowing how to reverse a binary tree.

~~~
tropo
Is there something special about reversing a binary tree?

AFAIK, you could swap the child pointers and do that recursively for the child
nodes. You could also do things O(1) by just changing the comparison function,
perhaps by wrapping it to negate the comparison.

~~~
shaftway
This is a specific, well-known case. Max Howell (the author of Brew) was
rejected by Google. One of his interviewers asked him to invert a binary tree.

[https://twitter.com/mxcl/status/608682016205344768?lang=en](https://twitter.com/mxcl/status/608682016205344768?lang=en)

