Google Interview questions

Here are some questions I got on my first interview with Google (slightly altered for NDA reasons).

1)Suppose you have an NxN matrix of positive and negative integers. Write some code that finds the sub-matrix with the maximum sum of its elements.

2)Write some code to reverse a string.

3)Implement division (without using the divide operator, obviously).

4)Write some code to find all permutations of the letters in a particular string.

5)You have to get from point A to point B. You don’t know if you can get there. What would you do?

6)What method would you use to look up a word in a dictionary?

7)Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval?

8)You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you fine the ball that is heavier by using a balance and only two weighings?

No comments: