ten Google interview questions

This was originally posted in mathNEWS, a publication put out by students at the University of Waterloo. Pretty interesting stuff, good to read up on if you are going for a high end Google-type job.

  1. Please describe a data structure that accomplishes the functions INSERT and FIND-MEDIAN in the best possible asymptotic time.
  2. Given a circularly sorted array, describe the fastest way to locate the largest element.
  3. Given a binary search tree and an integer k, describe the most efficient way to locate two nodes of the tree that sum to k.
  4. Given an arbitrarily connected graph, explain how to ascertain the reachability of a given node.
  5. If you have one billion numbers and one hundred computers, what is the best way to locate the median of the numbers?
  6. Describe an API for a cache, with all of the associated function signatures. Provide pseudocode for the simple one.
  7. Implement a special type of integer iterator. It will be a wrapper over a regular integer iterator, except that this iterator will only iterate over negative numbers. Show how you’d write the next() and hasNext() functions to work with the next negative integer instead of just the next integer.
  8. You are making an AI to play Tic-Tac-To. Make a function that takes a board position as an input and returns a good position to play. Describe how you’d represent the board, and how you’d determine where to play next.
  9. You are given 1001 numbers in an array. There are 1000 unique numbers and 1 duplicate. How do you locate the duplicate as quickly as possible?
  10. Say you are implementing exponentiation for a certain processor. How would you minimize the number of multiplications required for this operation?.

I have been in interviews that have asked very technical, industry specific questions. However they always tend to be more strait forward right or wrong questions. Never seen anything this open-ended before.



~ by underaglassmoon on August 26, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: