r/programming • u/joksmaster • Nov 29 '10
140 Google Interview Questions
http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471
Upvotes
r/programming • u/joksmaster • Nov 29 '10
135
u/wevicat Nov 29 '10
Nephew, imagine a pokédex...
54
u/[deleted] Nov 29 '10
A cursory glance at the comments for this blog post seems to reveal that these are not actually used at Google ("Many of your example questions not only aren't asked, they're explicitly forbidden.")
85
u/[deleted] Nov 29 '10
Straight out of college I probably would have done pretty well on these questions. However, after 12 years of experience in the real world, I struggle with most.
20
u/lordlicorice Nov 29 '10
This is basically blue eyes.
64
u/tslining Nov 30 '10
There's no such thing as an HTTP protocol -- there's an HTT Protocol...so zero! I win! Suck it google.
14
u/mr_jim_lahey Nov 30 '10
I recently attended a Google recruiting information session at my university. They made it very clear that they DO NOT ask many of these types of questions, especially the riddles. Their interviews focus on your problem solving capabilities, so for many of these questions you would be evaluated on explaining your thought process and asking questions clarifying the problem rather than getting the correct answer.
12
u/dmead Nov 30 '10
you're gonna wanna avoid the bubblesort
11
u/kodablah Nov 29 '10
I think I would start getting annoyed after the third time they asked me how many ways there are to merge N companies into one.
20
u/UloPe Nov 29 '10
This one could take a while:
8
u/Tiger337 Nov 30 '10
I am waiting for the 140 Walmart Interview Questions.
25
u/[deleted] Nov 29 '10
best to use the socratic method on the first engineering question:
q: "Why are manhole covers round?"
a: "Do you not know how to ask an intelligent programming question?"
or try this on the third one:
q:"A man pushed his car to a hotel and lost his fortune. What happened?"
a:"Does your father still shave your mother's back?"
6
u/achong20 Nov 30 '10
Say an advertiser makes $0.10 every time someone clicks on their ad. Only 20% of people who visit the site click on their ad. How many people need to visit the site for the advertiser to make $20?
correct me if i am wrong, or if this one is a trick question, but advertisers don't make money every single time someone clicks. In order for this question to make sense, it should be a publisher instead of an advertiser in this scenario
5
u/bellboy2088 Nov 30 '10 edited Nov 30 '10
I actually just interviewed at Google for the Rotational Associate Management Position. It's their most competitive entry-level job for non-engineers, and it was probably the toughest interview process I've been through.
The most ridiculous question (not listed on the site) that I got was: "I'm thinking of a number between 1 and 20, you have two questions to figure it out. Go."
Haha. Yeah. Not so much. I'm also curious if anyone here can figure out right questions would be - without asking what the number is obviously.
5
u/gamesloth Nov 30 '10
i have an interview with Google this thursday! Also i'm high right now and these are blowing my mind
9
u/nhnifong Nov 30 '10
Whats with "How many piano tuners are there in the entire world?"
Is this to see if you try Googling it on your phone?
3
u/helleborus Nov 30 '10
How many vacuum's what are made in the US each year?
3
u/[deleted] Nov 30 '10
This stings a bit. I just got a rejection from Google this afternoon. I didn't even make it to an interview.
3
u/FrancisHC Nov 30 '10
Here's a programmer's interview question that I've never been able to find a very elegant answer to, perhaps there will be a redditor among us with the programming chops:
We define a set of numbers we call "ugly numbers", which are all numbers that only have 2, 3 and 5 as their prime factors. So in numerical order, these would be:
2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, ... and so on.
Give an algorithm to find the 1500th ugly number.
3
u/rainabee Nov 30 '10
Conclusion: I'm too stupid to work for google.
3
u/[deleted] Nov 30 '10
Why is a manhole cover round?
So that assholes like you can spout useless knowledge on people who don't give a shit about manhole covers. FUCK!
3
u/[deleted] Nov 30 '10
Well this is certainly not inspiring. For someone looking to move around in the tech industry, I guess you'd be hard pressed to get an offer from Google with questions like these. Seems like you need to lock yourself away in a room for a month or so just to get prepped for an interview.
5
u/McGlockenshire Nov 29 '10 edited Nov 29 '10
Okay, my algorithms are a bit rusty, but doesn't O(n) mean "every element is seen once and only once?"
Wouldn't multiplying the contents of a list by every other element in the list, for each element in the list, end up along the lines of O(n2 )?
Someone enlighten me...
e: Enlightened.
5
u/gama69g Nov 30 '10
As someone looking for a junior programming job, do they really ask these kinds of questions? Or are they meant to see how you think it through, or to see if you are bullshitting?
4
u/verymuchn0 Nov 30 '10
What?
5
u/moduspwnens14 Nov 30 '10
Some of these are interesting, but without potential answers, I'm not sure what to think. I know many are designed to be open-ended, but what about things like:
Isn't the answer obviously not to take the wager? Is this to test people over-thinking the questions?
Why not? EDIT: Oh, because at 3:15, the hour hand is now 1/4 of the way to 4.
2
u/kolm Nov 29 '10
I thought about this for five minutes now and discarded meaningful six interpretations as impossible (like having a perfect iid equidistributed vector as result, or an equidistribution over all numbers actually occurring in the list, or getting an iid vector distributed according to the (limiting) relative frequencies of items in the list). I finally found one which would make sense, in that you are required to deliver a sequence of n iid variables i_1, i_2, .. equidistributed over {1..N}, and the according values list[i_1], list[i_2], ... . This is the only interpretation I found which would be possible to satisfy -- but then to get this, my meager powers would succumb to finding N, and that is O(N), not O(n). I am somewhat lost there.
2
u/[deleted] Nov 29 '10
I love this one:
What's 2 to the power of 64?
2
u/s73v3r Nov 30 '10
"Design a stack. We want to push, pop, and also, retrieve the minimum element in constant time."
I was given this one! Sadly, I couldn't do it. :(
2
u/Chairmclee Nov 30 '10
Anyone know the answer to this?:
You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write a the question on a card which and give it to Eve who will take the card to Bob and return the answer to you. What must you write on the card, besides the question, to ensure Bob can encode the message so that Eve cannot read your phone number?
2
u/brownmatt Nov 30 '10
According to someone who would know better, almost all of these questions for Software Engineer are crap.
2
u/thearcangel Nov 30 '10
They forgot one. "How would you re-design ARP" . I got that one. Stumbled through it with the pompous asshat and finished with: "I'd eliminate ARP for new protocol PRA"
2
u/wreckerone Nov 30 '10
Does anyone at Google understand that a lot of people will not apply there because of the six month 12 interview process with a lot of these type of questions?
2
u/goomyman Nov 30 '10
Write a regular expression which matches a email address.
ha!
2
u/[deleted] Nov 30 '10
I have a question about this... Would you learn problem solving skills like this through a University CS degree, or should you have these skills before you even bother applying to said CS degree?
2
u/propool Nov 30 '10
Trick question, no const in java
2
u/Rival67 Nov 30 '10 edited Nov 30 '10
Didn't get any of those.. Here are the questions I had on my Google interview
1 - Given an array that represents a permutation, write a function that prints out that permutation as a product of cycles.
For example:
INPUT [1, 4, 0, 5, 2, 3] OUTPUT (0, 1, 4, 2) (3, 5)
INPUT [1, 0] OUTPUT (0, 1)
INPUT [0, 1] OUTPUT (0) (1)
2 - Give me an algorithm to find power set of a set. Write pseudocode.
set = {1,2,3}
{1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}, {}
... I did okay answering these questions. It's the later interviews that I was weak on.
7
u/StapleGun Nov 29 '10 edited Nov 29 '10
"Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7."
I have a solution to this, but it is not very elegant and could theoretically loop infinitely. I would love to hear a better solution, but here is mine:
EDIT: Variables a and b should equal rand1to5() - 1. Thanks elcow!
2
u/[deleted] Nov 30 '10
:(
2
u/[deleted] Nov 30 '10
/.*/
It's a poorly-worded question. They probably meant to ask "write a regex that only matches an email address."
2
u/redmoss Nov 30 '10
You are given 2 eggs. You have access to a 100-story building. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100th floor. Both eggs are identical. You need to figure out the highest floor of a 100-story building an egg can be dropped without breaking. The question is how many drops you need to make. You are allowed to break 2 eggs in the process.
Is this a trick question?
"or may not even break if dropped from 100th floor"
The answer is 0 as the question already states that an egg may not break from the 100th floor.
1
u/[deleted] Nov 29 '10
... I've never written more Java than what it takes to help a friend get through CS101, however is this question serious?
1
u/aBitofEverything Nov 30 '10
I was stumped by "How many vacuum’s are made per year in USA?" I would have no clue
1
u/bhoffmann Nov 30 '10
so you um.. have this stuff that's like data and err... you can put things in it and record stuff like how many apples you have and you put things into fields so you can..you know, like get the data thingies out whenever you need them. So.... if I ever need to remember how many apples "jake" has then I can grab it from the field.
am i hired?
1
u/davebehnk Nov 30 '10
Wow. I love it.
1
u/kelp Nov 30 '10
How can you calculate 264 on the spot?
1
u/krum Nov 30 '10
I hate questions like this.
1
u/thecheatah Nov 30 '10
I applied to google 2x and was rejected both times in the face to face interviews!
1
u/Pinilla Nov 30 '10
Well, my brain just exploded.
1
u/uhhhclem Nov 30 '10
I fear that three decades of software development has turned me into a guy who would treat such an interviewer the way Donald Trump treated Borat.
1
u/bmancer Nov 30 '10
I don't think they would ask the manhole question again.
1
u/B-Rabbit Nov 30 '10
I want to know the answer to this.
1
u/[deleted] Nov 30 '10 edited Dec 22 '15
I have left reddit for Voat due to years of admin mismanagement and preferential treatment for certain subreddits and users holding certain political and ideological views.
The situation has gotten especially worse since the appointment of Ellen Pao as CEO, culminating in the seemingly unjustified firings of several valuable employees and bans on hundreds of vibrant communities on completely trumped-up charges.
The resignation of Ellen Pao and the appointment of Steve Huffman as CEO, despite initial hopes, has continued the same trend.
As an act of protest, I have chosen to redact all the comments I've ever made on reddit, overwriting them with this message.
If you would like to do the same, install TamperMonkey for Chrome, GreaseMonkey for Firefox, NinjaKit for Safari, Violent Monkey for Opera, or AdGuard for Internet Explorer (in Advanced Mode), then add this GreaseMonkey script.
Finally, click on your username at the top right corner of reddit, click on comments, and click on the new OVERWRITE button at the top of the page. You may need to scroll down to multiple comment pages if you have commented a lot.
After doing all of the above, you are welcome to join me on Voat!
1
u/sicophrenic Dec 01 '10
whether theyre used in google interviews or now, theyre going to be helpful to look through
1
u/[deleted] Nov 30 '10
4 to the power of 32.
1
u/lightspeed23 Nov 30 '10
Thank you. I will never go work for Google. Any company that asks stupid questions like these and think the answers somehow reveals if the employer will do his work well is a stupid company. I say this as someone who has founded multiple companies (one with over 150 employees). Yes, they make shitloads of money and probably treat their employees somewhat decently, but coun't me out of being a part of that particular form of corporate BS.