Google Interview experience For SDE-1

 

Round 1: Hangout Video call ( DS & Algo) ( 1 hr )

  1. Tell me something about yourself.
  2. There is one marathon is happening. Each runner has unique no which is printed on his t-shirt. Cameraman is trying to capture that number from top so no is visible in 180 degree rotation. X  is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X.  Each digit must be rotated – we cannot choose to leave it alone. 0, 1, and 8 rotate to themselves; 6 and 9 rotate to each other, and the rest of the digits  do not rotate to any other valid digit. Range is given and you need to find out good numbers lie within that range.

Cases:

  • 10 will be converted into 01 but not valid as our range start with 1. Prefix 0’s are not allowed.
  • If range is 1 to 7 and no 6 become  9 so it won’t allowed.
  • 11 won’t allow as 11 will become same after change.
  • If no has digits like 2, 3, 4, 5, 7 then that no won’t allow.
  • Input: range: 1 to 10 (1 and 10 both are included)
  • Output: list of valid numbers: 6, 9

You can consider this  link for reference: https://www.geeksforgeeks.org/check-if-a-given-number-is-fancy/

Round 2: On-site (Behavioural Round) ( 1 hr )

  1. Tell me about yourself
  2. Why Google?
  3. Which product of Google you like most? Why? Any competing product in the market?
  4. If I asked your current organization for feedback then what will they say? Focusing on negative point.
  5. If you have to improve one technical and one behavioural point then which one will you improve?
  6. In your last organization or before that any leadership work have you done? Mentorship / organizer type.
  7. What will you do when your work’s credit will be given to other person?
  8. Any situation when your manager didn’t agree with your idea and how did you convince him?
  9. Why you are leaving before 1 year?
  10. What is your plan for 2 years in technical and non-technical aspects?
  11. Do you have any questions for me?

Round 3: On site ( DS & Algo) ( 1 hr )

She asked for binary search functionality which tells no exists in array or not. Generally we find mid element through (low+high)/ 2 so she asked to change that and use random function to decide mid. Binary search is performed on sorted array but here unsorted array is given.

Two modifications are performed on binary search logic.

1) instead of sorted array, unsorted array has been given

2) Mid element is decided based on random function. Now we have to find out numbers from given array for which this function gives true result.

Hint: Function will return true for value x, if all numbers on left side of x are small and all number on  the right side of x are greater. 

Example: [ 4, 3, 1, 5, 7, 6, 10]

Ans: 5, 10

Time Complexity: O(n)

Space Complexity: O(n)

Round 4: On site ( DS & Algo) ( 1 hr )

One chocolate bar is given. There are n number of pieces in that bar. Each piece has its own sweetness level. You have to divide chocolate bar in k pieces and give those pieces to k-1 persons and you will get remaining last piece. You have to tell how much sweetness you will get. You will get least sweetness piece out of all k pieces. So you have to divide slab in such a way that you will get maximum sweetness.

Input: 1, 2, 4, 7, 3, 6, 9  N = 7, K = 4

Output: 7 (Divide it into 4 parts like [1, 2, 4] [7] [3, 6] [9] with sweetness level 7, 7, 9, 9 respectively)

Links for reference:

https://www.geeksforgeeks.org/painters-partition-problem/

https://www.geeksforgeeks.org/allocate-minimum-number-pages/

Round 5: On site ( DS & Algo) ( 1 hr )

Similar to Round 4. There were n people each having some weight. You have to divide them in k continuous group such that total weight difference between groups will be minimised. You have to return difference between max and min weighted group.

Input: 1, 2, 4, 7, 3, 6, 9  N = 7, K = 4

Output: 2 (Divide it into 4 parts like [1, 2, 4] [7] [3, 6] [9] with weight 7, 7, 9, 9 respectively So answer will be 9 – 7)

Round 6: On site ( DS & Algo) ( 1 hr )

One grid is given. It contains characters in each cell. You have to find out the smallest hamilton distance between x to y. Hamilton Distance:  | row_index_x – row_index_y | + | column_index_x – column_index_y | 

[ x, 0, 0, 0 ]

[ 0, y, 0, y ]

[ x, x, 0, 0 ]

[ 0, y, 0, 0 ]  Ans: 1

Time Complexity: O(n x m)

Space Complexity: O(n x m)

Google mainly focuses on logic and how you are coming with solution. It notes down each and every small mistake. Interviewers are really very helpful. They expects clear code with optimal approach.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


7


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.