share
Stack OverflowGoogle Interview Questions
[+161] [14] Mark
[2009-01-16 05:34:33]
[ google ]
[ http://stackoverflow.com/questions/449595/google-interview-questions ] [DELETED]

I am preparing for an interview with Google (Mountain View) I was wondering if anybody could share some of the questions and experiences.

I have been told that they ask both brain teasers and coding/algorithm questions this time

(31) How did the interview go Mark? - Victor
Are you allowed pencil and paper? - Waley Chen
(1) I believe they'd ask you to sign a non-disclosure agreement - warl0ck
(7) @Kaushik I got an offer. Went with another offer simply because it provided a more interesting career path - Mark
[+108] [2009-01-16 05:47:04] Matthew McDole [ACCEPTED]

Steve Yegge's Get That Job At Google [1] is the best resource I know of.

[1] http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html

(12) Even if your not not applying for a google job, thats still a good read :) - Chalkey
(8) This is an old thread, but they now use pretty much all of "Steve Yegge's" list and send it out to applicants now. Also they now suggest a book wiley.com/WileyCDA/WileyTitle/productCd-047012167X.html which was great help. They used a question from it word for word for my phone interview with them. - Tim McJilton
@Tim McJilton; did you mention you'd already heard the question? - Dean J
@Dean J I did not mention I heard the question. Though the funny thing was that out of all of the questions in the book, that question they asked was the one I skipped over thinking to myself "Oh I know how to do that, meh" - Tim McJilton
that is much helpful link... :-) - poddroid
i found careercup.com/book very good for all around preparation. - null
Actually,i have printed that blog and buried it under my pillow. - zionpi
1
[+68] [2009-01-16 07:01:18] Jon Skeet

Each interviewer is encouraged to think up their own questions, and we have a list of "banned" questions that are too widely known. Also, if you already know about the question it will be pretty obvious to the interviewer, and they'll either make it harder or just ask a different one.

Steve Yegge's advice that Simucal referenced is really good. Basically, know your stuff and don't be too downhearted if you don't get in. (Pretty much everyone I talk to at work says they're the fluke that did get in and shouldn't have done. We all view the recruiting process as a really, really high bar.)

Good luck!


Does that apply globally? I mean, sounds preety much like company policy. I was thinking of applying in Brazil, got discouraged for other reasons (including moving to Brazil). - Tom
As far as I'm aware it's company policy. - Jon Skeet
(9) Too be honest I wasn't impressed with the 2nd round interview I had with Google 5 years ago. Prior to the interview they said I would be asked C++ questions and then I was asked several Unix sysadmin type questions that I could google answers to and one problem solving question, a regular expression to validate ip addresses, which is far too hard to get right over the phone. If they'd read my cv, asked questions to my strengths, it could have been different. I mean I have patched libstdc++ at least once so I know something about the language. - sashang
(5) Hey, Brazil is not a bad place. :) - asandroq
@Jon Skeet: would they ask me language specific questions? For eg. Use c++ to solve this problem. I'm going to be interviewed online for a C++, Windows developer job. - Shawn Mclean
@ShawnMclean: If you've said you're good in C++, then you may be expected to know C++. The interviewer may say you can use whatever you like though. - Jon Skeet
2
[+46] [2010-10-19 18:24:27] Amit Prakash

I have worked for Google and Microsft and done a ton of these interviews. We just published a book called " Algorithms for Interviews [1]". Me and my co-author have put in 2 years of effort in it and we think the end result is very nice. I'd highly recommend it to anyone who is preparing for an algorithms/coding interview. Also, I'd love to get your feedback on the book at amit@algorithmsforinterviews.com

Here is a sample of problems from the book:

  • A triomino is formed by joining three unit-sized squares in an L-shape. A mutilated chessboard is made up of 64 unit-sized squares arranged in an 8-by-8 square, minus the top left square.

    Design an algorithm which computes a placement of 21 triominos that covers the mutilated chessboard.

  • The mathematician G. H. Hardy was on his way to visit his collaborator S. Ramanujan who was in the hospital. Hardy remarked to Ramanujan that he traveled in a taxi cab with license plate 1729, which seemed a dull number. To this, Ramanujan replied that 1729 was a very interesting number - it was the smallest number expressible as the sum of cubes of two numbers in two different ways. Indeed, 10x10x10 + 9x9x9 = 12x12x12 + 1x1x1 = 1729.

    Given an arbitrary positive integer, how would you determine if it can be expressed as a sum of two cubes?

  • There are fifty coins in a line---these could be pennies, nickels, dimes, or quarters. Two players, $F$ and $S$, take turns at choosing one coin each---they can only choose from the two coins at the ends of the line. The game ends when all the coins have been picked up. The player whose coins have the higher total value wins. Each player must select a coin when it is his turn, so the game ends in fifty turns.

    If you want to ensure you do not lose, would you rather go first or second? Design an efficient algorithm for computing the maximum amount of money the first player can win.

  • You are given two sorted arrays. Design an efficient algorithm for computing the k-th smallest element in the union of the two arrays. (Keep in mind that the elements may be repeated.)

For more sample problems, you can look here [2].

[1] http://algorithmsforinterviews.com
[2] http://www.algorithmsforinterviews.com/programminginterviewquestions

(3) a shameless plug :-) but that book is so going on my wish list. - Gareth Davis
Amit...that sounds like one hell of a book. Yes..is going on my wish list too. - Victor
(8) The face in the cover of the book seems a mixture of Michael Jackson with Herr Hitler. But the book seems OK, though. - karlphillip
(2) Thanks for the feedback Karl. The face was actually constructed from an Alan Turing portrait, using tiles of various great Computer Scientists and mathematicians :) - Amit Prakash
(2) shame you still don't have kindle edition - aviad
3
[+22] [2009-10-28 04:29:15] Seattle Interview Coach

I've put together 140 Google interview questions. You might find it helpful.

Check it out: http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html

  • Seattle Interview Coach

I'm not sure if this could get u a job at google..but sure gets some stuff to learn - ravz
4
[+8] [2009-01-16 05:39:28] Shivasubramanian A

I remember reading somewhere that interviewees at Google have to sign an NDA about the questions being asked. So how do you expect people to tell you what questions they have asked?

Anyway, as aku said, search the Internet.. you might not find specific questions, but you will get to know in which areas they ask questions from...

All the best!!


(1) people do break NDA's in that level of "secrecy" you know - DFectuoso
(2) I, personally, never signed any NDAs. - A. Rex
5
[+6] [2011-04-15 23:46:34] techinterview

I had phone interview with google for software engineer position. I was asked to develop a cache interface and implementation in java.

public interface ServerCache {

    public void storeCache(String keyOfObject, Object objectToStore);

    public Object getCachedObject(String keyOfObject);

}

public class ServerCacheImp implements ServerCache {
    LinkedList queue = new LinkedList();
    Hashtable cacheStorage = null;

    public ServerCacheImpl() {
        cacheStorage = new Hashtable();
    }

    public Object getCachedObject(String keyOfObject) {
        queue.remove(keyOfObject);
        queue.add(keyOfObject);

        return cacheStorage.get(keyOfObject);
    }

    public void storeCache(String keyOfObject,Object objectToStore) {
        String key=””;
        Object existingObj=cacheStorage.get(keyOfObject);

        if(cacheStorage.get(keyOfObject)!=null&&existingObj.equals(objectToStore)){
            return;
        }

        if(queue.size()>1000){
            key=(String)queue.remove();
            cacheStorage.remove(key);
        }

        queue.add(keyOfObject);
        cacheStorage.put(keyOfObject,ObjectToStore);
    }
}

6
[+4] [2009-01-16 06:45:45] melaos

Although not directly related you might want to check this previous discussion:

interview-programming-test-practice [1]

Or this book: Programming-Interviews-Exposed-Secrets-Landing/ [2]

[1] http://stackoverflow.com/questions/35901/interview-programming-test-practice
[2] http://rads.stackoverflow.com/amzn/click/0471383562

7
[+4] [2011-01-11 15:13:53] Subbrice

For a software engineer I found this link pretty good

http://mysubwaydream.blogspot.com/2011/01/google-interview-questions.html


8
[+4] [2011-08-19 18:11:51] sbwoodside

I'm surprised no one's linked to the list of 10 questions that was printed U(W)'s *math*NEWS in 2008: Ten Google interview questions - Actual, real interview questions! [1]. Having been through google interviews myself and coached friends, these are good practice questions.

As others point out, Steve Yegge's post [2] is the first thing to read.

Then, you must practice with paper or a whiteboard. Get a friend over, give them some beers, and have them pick questions from any of these lists and ask them to you. If they think you've made a mistake, they should say "are you sure that's correct?". If you provide an algorithm that's not optimal, they should say "is there any faster way to do it?".

First you should simply describe a simple solution, and then iteratively improve it. Also, be sure to go through examples that you create at the start to show that you understand the problem and to get some different forms of the input data into your head.

[1] http://www.mathnews.uwaterloo.ca/Issues/mn10704/googlequestions.php
[2] http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html

9
[+2] [2009-06-25 06:16:27] Prashant

I'm not kidding, when Google conducted interview in our college in Bangalore...

I got very weird questions completely out of scope like "How many buses does local transport corporation [1] own ?"

So, be ready with some local facts

n Best of luck :)

[1] http://www.bmtcinfo.com/english/index.htm

(9) That's actually a fairly common style of interview question. The goal isn't to test your trivia knowledge, but rather to see how well you can make a back-of-the-envelope estimate about something. Jon Bentley discusses this in his wonderful book, "Programming Pearls." - Keith Smith
(13) Yeah, the idea isn't "they own 237 buses", but more "they transport 4 million people a day, two ways, 50 people fit on a full bus, a ride might be 30 minutes, morning rush hours are four hours long, so 4 million people divided by eight time-slots in morning rush is 500,000, divided by 50ish people per bus, they'd have to own 10,000 buses to make it work, plus a couple of spares for maintenance or whatever". - Dean J
10
[+2] [2009-10-13 13:24:00] Pavel Podlipensky

Take a look on this web site http://google-interview.com Seems they gather all "google stories" mentioned above.


11
[+2] [2010-10-22 08:35:50] Brian

I used this one earlier for Google Interview questions Few more good ones are found here as well. http://www.freshersinterviewquestions.com/category/google-interview-questions/


12
[+2] [2011-01-07 02:10:52] Subbrice
13
[+2] [2011-10-28 18:54:39] Sachin

You can check the following sites, they have a lot of Google questions and for other companies as well

My Career Stack [1]

LeetCode [2]

[1] http://learn.hackerearth.com/questions/?company=Google
[2] http://www.leetcode.com

14