Phone Round - Degree of an array - leetcode
Onsite:
Round 1: (45 mins)
Technical discussion with Manager who sounded less confident, less techy and not sure about bunch of technologies I spoke about. Overall I felt that he has his own bubble and always stayed in that. Dont know about things going outside his comfort zone.
Round 2: Coding round (Bring your own laptop and code it there itself) - 90 min
You have a clock and 4 pennies, 4 nickel, 4 dimes. You need to find all the combinations of coins so that they can be placed on the clock such that no coin is repeated on the clock. One example is PPDDNNPDDPNN.
Here is the solution in python with problem description:
https://github.com/atsepkov/puzzles/tree/master/interviews/easy/coins-on-clock
https://stackoverflow.com/questions/43825638/how-can-you-determine-how-to-place-coins-on-a-clock
I solved this question half of it. My code ran and worked perfectly fine. Then I was out of time so I told them about my approach for the other half.
Round 3 (Behavioral Round): 1 hour with lunch
Challenges
Team conflicts
Proud Project
and other stupid questions
Round 4 (Coding Round):
You are given a 3X3 matrix which has 3 colors ballon Red, Blue and Green.
Consider Red - 1, Blue - 2, Green - 3 in the below matrix. In your program you will pass row and col. Whatever value appears in the matrix for that row and column, that value including its 4 neighbours of the same type (up, left, down, right) should be popped. Now imagine as if gravity is pulling your popped matrix down. After its popped you need to replace the popped value with 0 pull the rows of the matrix to the bottom. Example:
Given matrix:
3 2 3
1 3 1
1 2 2
int[] popMatrixBallons(int [][] matrix, int row, int col) {
//your code goes here
}
Lets say you pass row = 1, col = 0. You got value = 1
Step 1:
1. Pop(replace) row 1 and col 0 with value 0. Also replace its 4 neighbours with 0 if there is a 1.
So your resulting matrix will look like this
3 2 3
0 3 1
0 2 2
Step 2:
Now apply gravity on your matrix:
Because you popped (1,0) and (2,0) so column zero will be pulled by gravity. And number 3(0,0) will be pulled at the bottom of the matrix. So your final answer will be
0 2 3
0 3 1
3 2 2
At first attempt I said I will do it using dfs. My interviewer looked surprised with that word. I then understood he doesn't knows anything about dfs, bfs. Then I said depth first search. After that he gave me some tips and I was able to code it and run my program.
Next morning: REJECTED.