Google Interview Question

I think it is just typical questions.

Interview Answers

Anonymous

Feb 12, 2014

(1) I need two iterations. First, keep the first location where it should be rounded up. Second, round up and set the remain digits as zero. O(n) (3) 2^x > 50,000,000,000 2^32 = 4,200,000,000 (we knew it) therefore x = 36

Anonymous

Feb 21, 2014

1. Recurse to the last element and return the carry over. Add carry over to the current element and return carry over. If the calling function receives a carryover as 1, then add a new node to the linked list at the start of the list and set it to 1. 2. 3. 50,000,000,000 = 50*10^9 = 50 * 10^3 * 10^3 * 10^3 = 50* 2^30 = 2^5.5 * 2^30 = 2^35.5. Assuming that you know that 1000 is 2^10, and roughly guessing that 50 = 2^5.5, you can answer it as 35.5 years.

1