# Algorithm puzzle

Tags: , , | Posted by Admin on 2/18/2011 11:04 PM | Comments (0)
Given a sorting order string, sort the input string based on the given sorting order string. Ex sorting order string -> dfbcae Input string -> abcdeeabc output -> dbbccaaee

# Recent question from google's interview

Tags: , | Posted by Admin on 12/19/2010 11:37 AM | Comments (0)
Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announce that at least one husband has been unfaithful. What happens? Any answers? :)

# Just single question

Tags: , , | Posted by Admin on 5/16/2010 11:19 PM | Comments (0)
Question Come out with an algorithm for getting the column number provided the column name in a excel sheet and vice versa. Excel has a naming convention of A,B..Z,AA,AB,AC..ZZ,AAA… This had to be converted to the column numbers. A will be 1 and AA will 27.. Also the algorithm to find the name provided column number.   Answer #include <string> #include <iostream> using namespace std; int ExcelColNum (char *name) {     int s = 0;     for (int i=strlen(name)-1, e=1; i>=0; –i, e*=26) {         s += e*(name[i]-’A'+1);     }     return s; } string ExcelColName (int num) {     string name;     for ( ; num; num/=26) {         name.insert (name.begin(), ‘A’+(num-1)%26);     }     return name; } int main(void) {     cout << "AAA ==> " << ExcelColNum ("AAA") << endl;     cout << "703 ==> " << ExcelColName (703) << endl;     return 0; }   Results are, AAA ==> 703 703 ==> AAA

# I Interviewed To Be Google's "Head Of Social" And It Was Terrible

Tags: , | Posted by Admin on 5/12/2010 3:25 PM | Comments (0)

Tags: , , | Posted by Admin on 5/9/2010 10:03 AM | Comments (0)
http://www.youtube.com/watch?v=E2dMmdewRxE&feature=player_embedded Want to apply for a job at Google? Fitz and Ben from Google’s Chicago office share useful tips that might help get your résumé noticed by the hiring managers at Google. One of the key things they stress upon in this video is open-source. If you are a software engineer who’s fresh out of college with no job experience, get yourself involved in some open-source project, contribute code and that may improve your chances of landing a job interview.

Tags: , , | Posted by Admin on 4/30/2010 10:23 AM | Comments (0)

# Google seeks employees who speak nothing but geek

Tags: , | Posted by Admin on 12/3/2009 10:38 AM | Comments (0)

# Google talent search: error 502

Tags: , , | Posted by Admin on 12/2/2009 10:34 AM | Comments (0)

# Career Help

Tags: , | Posted by Admin on 11/23/2009 10:27 AM | Comments (0)

# Too clear to be useful?

Tags: , | Posted by Admin on 11/19/2009 2:39 PM | Comments (0)

# Dress Code

How can you go wrong with a jacket and tie, or a nice suit? Be well groomed, look your best, and dont think that its old fashioned and out of style. first impressions are the most lasting ones. you may be the most qualified, but if you show up looking like Smeagle from the Lord of the Rings or one of those orcs, i dont think you are gong to get the job. Cover the tats, get rid of the nose rings, piercings etc. get a nice haircut. Be well groomed and go for it. remember, once you are in your work environment you can take your cue from your fellow workers to see whats appropriate dress. good luck and let me know how it goes. and be a little bit early.! Try to look smart, but be casual at the same time. Don’t look like you’re trying too hard to impress them though!!

# The Mystery of the Google Interview

Tags: , | Posted by Admin on 11/16/2009 10:41 AM | Comments (0)

# Broken Hiring Process

Tags: , , | Posted by Admin on 10/30/2009 1:22 PM | Comments (0)
Ryan Tate of Silicon Valley Insider quotes Google's director of research Peter Norvig: One of the interesting things we've found, when trying to predict how well somebody we've hired is going to perform when we evaluate them a year or two later, is one of the best indicators of success within the company was getting the worst possible score on one of your interviews. We rank people from one to four [one being the worst], and if you got a one on one of your interviews, that was a really good indicator of success. Tate notes elsewhere in his piece that the Google interview process involves crazy questions. Tate doesn't connect the dots, but asking those sorts of questions in a job interview is essentially a way of giving a prospective employee a de facto IQ test (giving actual IQ tests to prospective employees has been legally problematic since Griggs v. Duke Power). Back to Googler Peter Norvig: Ninety-nine percent of the people who got a one in one of their interviews we didn't hire. But the rest of them, in order for us to hire them somebody else had to be so passionate that they pounded on the table and said, "I have to hire this person because I see something in him..." My guess at what's going on here: creativity probably increases directly with IQ up to a certain point, at which it peaks and then declines. So if you are looking for an employee who's going to come up with the next killer app or new line of business for your company, and you hire only the candidates with the highest IQs, you are probably overshooting the IQ sweet spot where you'd find the smart, creative types.

# Questions for different positions

Tags: , | Posted by Admin on 10/25/2009 8:35 AM | Comments (0)

# Real interview questions

Tags: , | Posted by Admin on 8/1/2009 10:49 PM | Comments (0)
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?.

# A list of interview puzzles used at Google.

Tags: , , | Posted by Admin on 7/28/2009 10:48 PM | Comments (0)
You have to get from point A to point B. You don’t know if you can get there. What would you do? 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? What method would you use to look up a word in a dictionary? Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announce that at least one husband has been unfaithful. What happens? 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? How do you cut a rectangular cake into two equal pieces when someone has already taken a rectangular piece from it? The removed piece an be any size or at any place in the cake. You are only allowed one straight cut. How many piano tuners are there in the entire world? What gives you joy? Mike has \$20 more than Todd. How much does each have given that combined they have \$21 between them. You can’t use fractions in the answer. Hint: This is a trick question, pay close attention to the condition) How many times a day a clock’s hands overlap? Two MIT math graduates bump into each other. They hadn’t seen each other in over 20 years. The first grad says to the second: “how have you been?” Second: “Great! I got married and I have three daughters now” First: “Really? how old are they?” Second: “Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there..” First: “Right, ok.. oh wait.. I still don’t know” second: “Oh sorry, the oldest one just started to play the piano” First: “Wonderful! my oldest is the same age!” Problem: How old are the daughters? If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? (The answer to this is not zero!) Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it’s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes? If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)? In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country? You have an empty room, and a group of people waiting outside the room. At each step, you may either get one person into the room, or get one out. Can you make subsequent steps, so that every possible combination of people is achieved exactly once?

# Google Interview Questions – Some Resolution

Tags: , , | Posted by Admin on 7/25/2009 10:43 PM | Comments (0)
All the below questions are to be done in O(n) time complexity. 1>Given an array of size n-1 whose entries are integers in the range [1, n], find an integer that is missing. Use only O(1) space and treat the input as read-only. 2>Given an array of size n-2 whose entries are integers in the range [1, n], find two integer that are missing. 3>There is an array A[N] of N integers. You have to compose an array B[N] such that Output[i] will be equal to the product of all the elements of A[] except A[i]. or Example: INPUT:[4, 3, 2, 1, 2] OUTPUT:[12, 16, 24, 48, 24] Solve it without division operator and in O(n). Solution : 1>Let the missing number be M. We know that the sum of first N natural numbers is N*(N+1)/2. Traverse through the array once and calculate the sum. This is the sum of first N natural numbers – M or S=N*(N+1)/2 – M. Therefore M = N*(N+1)/2 – S. 2>Similar approach to the first one. Traverse the array once and calculate its sum and multiplication. Let the sum be S and multiplication be M. Let the missing numbers be P and Q. From above we know that P+Q = N*(N+1)/2 – S. Also P*Q = N!/M. So we can get P and Q from these two equations. 3> Lets first see the C++ solution. void solution(vector<int> A) { int N=A.size(),i,j; vector<int> L(N,0); vector<int> R(N,0); vector<int> B(N,0); for (i=0,j=N-1; i=0 ;i++, j–) { L[i] = i==0? 1 : A[i-1] * L[i-1]; R[j] = j==N-1? 1 : R[j+1] * A[j+1]; } for (i=0; i { B[i] = L[i] * R[i]; printf(“%d “,B[i]); } } Most is clear from the program. Anyways, through the L and R we calculate the multiplication of terms to the left and right of i-th term. then finally we multiply it to get the result.

# How I Prepared for My Google Interview

Tags: , , | Posted by Admin on 7/21/2009 10:33 PM | Comments (0)

# Preparing for a second job interview

Tags: , , , | Posted by Admin on 7/19/2009 10:28 PM | Comments (0)

# Goggle: 01-18-09 Why Google Employees Quit, Organizational Behavior

Tags: , | Posted by Admin on 1/18/2009 3:39 PM | Comments (0)

# Christmas interview

Tags: , | Posted by Admin on 12/31/2008 9:45 AM | Comments (0)

# Rajat Kansal: Third Phone Screen with Google

Tags: , , | Posted by Admin on 12/27/2008 10:32 AM | Comments (0)

# Rajat Kansal: Second Phone Screen with Google.

Tags: , , | Posted by Admin on 12/27/2008 10:31 AM | Comments (0)

# Rajat Kansal: First Phone Screen with Google.

Tags: , , | Posted by Admin on 12/27/2008 10:29 AM | Comments (0)

# Rajat Kansal: First Information from Google

Tags: , | Posted by Admin on 12/27/2008 10:27 AM | Comments (0)