Saturday, September 8, 2012

Placement test and interview puzzles

Couple of juniors have been asking me for the placements tips. Frankly, I don't have any but I can certainly help you guys out with some technical part. I solved quite a lot of puzzles during my placement season and sharing some of those with you. Here are couple of links that I think can be useful for interviews.
  1. Problems(with solutions) categorized based on the companies. It has problems from interviews of companies like Google, Microsoft, Adobe, Goldman Sachs and more than hundred other companies
    http://www.careercup.com/page

    There are some useful tips other than problems as well. You may wanna check those out too.
  2. Common puzzles asked in the interview and tests(I was asked half the questions in my interview from this problem bank).
    http://research.microsoft.com/en-us/um/people/leino/puzzles.html
  3. Puzzles(with solutions) with ratings(difficulty level) for each puzzle.
    http://www.qbyte.org/puzzles/puzzle02.html
There are other collection of problems but these are the three big pool of problems I have. If you want other links(with fewer problems) contact me personally. And if you have any other useful links please comment or mail me the list so that I can include those in the list. 

(Check out the previous posts also for the problems asked in some of the interviews last year)

Just for the starter, here are a few problems which were asked in Adobe's interview. My friend Romil was asked these problems in the interview and he wrote some of them down to share with everybody .
  1. You are given a binary tree and 2 data values. Find the lowest common ancestor of the two concerned nodes( Only data values are given, not pointers to nodes).
  2. An array contains integers in the range 1-n. There are n-1 different numbers in the array and one is repeated. Which number is missing? Use only a single pass and don't allocate additional memory.
  3. Consider the following hash function: h(x) = ((x mod 1000) div 100) + x mod 10
    What kind of values will map to the same location?
  4. Output of following:
    int *i, *j;
    i = (int*)60;
    j = (int*)20;
    printf(i-j);
Here are some other random puzzles: 
  1. Two players take turns choosing one number at a time (without replacement) from the set {−4, −3, −2, −1, 0, 1, 2, 3, 4}.  The first player to obtain three numbers (out of three, four, or five) which sum to 0 wins. Does either player have a forced win.
  2. Consider a two dimensional grid with nodes (x,y) where x,y>0. Consider a particle initially at point (1,1). If the particle is at (x,y), it can move to either (x+y,y) or (x,x+y). Can the particle starting at (1,1) reach (m,n)? What should be the relation between such m and n?

Good Luck for the placements! I hope these links helps you with your tests.