1. Given a number, describe an algorithm to find the next number which is prime.
  2. There are 8 stones which are similar except one which is heavier than the others. To find it, you are given a pan balance. What is the minimal number of weighing needed to find out the heaviest stone ?
  3. There are a set of 'n' integers. Describe an algorithm to find for each of all its subsets of n-1 integers the product of its integers. For example, let consider (6, 3, 1, 2). We need to find these products :
    • 6 * 3 * 1 = 18
    • 6 * 3 * 2 = 36
    • 3 * 1 * 2 = 6
    • 6 * 1 * 2 = 12
  4. Given two sorted postive integer arrays A[n] and B[n] (W.L.O.G, let's
    say they are decreasingly sorted), we define a set S = {(a,b) | a \in A
    and b \in B}. Obviously there are n^2 elements in S. The value of such
    a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs
    from S with largest values. The tricky part is that we need an O(n)
    algorithm.

  5. Solve this cryptic equation, realizing of course that values for M and E could be interchanged. No leading zeros are allowed.

    WWWDOT - GOOGLE = DOTCOM

  6. Write a haiku describing possible methods for predicting search traffic seasonality
  7. 1
    1 1
    2 1
    1 2 1 1
    1 1 1 2 2 1
    What's the next line?

    312211. This is the "look and say" sequence in which each term after the first describes the previous term: one 1 (11); two 1s (21); one 2 and one 1 (1211); one 1, one 2, and two 1's (111221); and so on. See the look and say sequence entry on MathWorld for a complete write-up and the algebraic form of a fascinating related quantity known as Conway's constant.

  8. You are in a maze of twisty little passages, all alike. There is a dusty laptop here with a weak wireless connection. There are dull, lifeless gnomes strolling around. What dost thou do?

    A) Wander aimlessly, bumping into obstacles until you are eaten by a grue.
    B) Use the laptop as a digging device to tunnel to the next level.
    C) Play MPoRPG until the battery dies along with your hopes.
    D) Use the computer to map the nodes of the maze and discover an exit path.
    E) Email your resume to Google, tell the lead gnome you quit and find yourself in whole different world [sic].

    In general, make a state diagram . However, this method would not work in certain pathological cases such as, say, a fractal maze. For an example of this and commentary, see Ed Pegg's column about state diagrams and mazes .

  9. What's broken with Unix?

    Their reproductive capabilities.

    How would you fix it?

  10. On your first day at Google, you discover that your cubicle mate wrote the textbook you used as a primary resource in your first year of graduate school. Do you:

    A) Fawn obsequiously and ask if you can have an autograph.
    B) Sit perfectly still and use only soft keystrokes to avoid disturbing her concentration
    C) Leave her daily offerings of granola and English toffee from the food bins.
    D) Quote your favorite formula from the textbook and explain how it's now your mantra.
    E) Show her how example 17b could have been solved with 34 fewer lines of code.

  11. Which of the following expresses Google's over-arching philosophy?

    A) "I'm feeling lucky"
    B) "Don't be evil"
    C) "Oh, I already fixed that"
    D) "You should never be more than 50 feet from food"
    E) All of the above

  12. How many different ways can you color an icosahedron with one of three colors on each face?
  13. On an infinite, two-dimensional, rectangular lattice of 1-ohm resistors, what is the resistance between two nodes that are a knight's move away
  14. In your opinion, what is the most beautiful math equation ever derived?

    There are obviously many candidates. The following list gives ten of the authors' favorites:

    1. Archimedes' recurrence formula : , , ,
    2. Euler formula :
    3. Euler-Mascheroni constant :
    4. Riemann hypothesis: and implies
    5. Gaussian integral :
    6. Ramanujan's prime product formula:
    7. Zeta-regularized product :
    8. Mandelbrot set recursion:
    9. BBP formula :
    10. Cauchy integral formula:

  15. Which of the following is NOT an actual interest group formed by Google employees?

    A. Women's basketball
    B. Buffy fans
    C. Cricketeers
    D. Nobel winners
    E. Wine club

  16. What will be the next great improvement in search technology?
  17. What is the optimal size of a project team, above which additional members do not contribute productivity equivalent to the percentage increase in the staff size?

    A) 1
    B) 3
    C) 5
    D) 11
    E) 24

  18. Given a triangle ABC, how would you use only a compass and straight edge to find a point P such that triangles ABP, ACP and BCP have equal perimeters? (Assume that ABC is constructed so that a solution does exist.)
  19. Consider a function which, for a given whole number n, returns the number of ones required when writing out all numbers between 0 and n. For example, f(13)=6. Notice that f(1)=1. What is the next largest n such that f(n)=n?
  20. What is the coolest hack you've ever written?
  21. What number comes next in the sequence: 10, 9, 60, 90, 70, 66, ?

    A) 96
    B) 1000000000000000000000000000000000 0000000000000000000000000000000000 000000000000000000000000000000000
    C) Either of the above
    D) None of the above

  22. In 29 words or fewer, describe what you would strive to accomplish if you worked at Google Labs.