Capital One OA - May 2025
Anonymous User
2006

4 questions in 70 mins:

  1. Dont remember exactly.

  2. Given height of sticks in an array and the initial position of bird which has fixed stick height of 0, she picks up sticks from both side alternatively. In other words, it will first start right to find the stick and bring it to the initial position, then start left to do the same. Return all the indices from where the bird picks up the sticks until the total height of all sticks reaches 100.

  3. Given a matrix of colors filled in the cells (or can be empty too), user takes turns to pop the cells. If the cell was empty, nothing happens but if user pops color filled cell, all the cells diagonally adjacent will also get popped if sharing the same color. So for eg:

4 3 2
1 0 2
0 1 1
1 4 4

is the matrix given and the user clicks on [2,1] then the following cells will pop:
[1,0], [2,1], [3,0]

If the cells pop, there's a simulation of all the colors above the cells popped to drop down. In the above example after popping the cells [[1,0], [2,1], [3,0] , cols 0 and 1 will be affected(all the cells above [1,0], [2,1], [3,0] will drop down):

0 0 2
0 0 2
0 3 1
4 4 4

will be the final state. As you observe color 4 from [0,0] fell down to [3,0]. Similarly for color 3 at 0,1. It's just like Candy Crush.

  1. An array of slots is given which are all initially uncolored. n queries [x,y] will be given where x = position, y = color. Each query means to paint slot at x position with color y. For each query find out how many consecutive slot pairs share the same color.
    Eg: [0,0,0,0,0,0]
    Queries: [[1,2],[2,2],[0,3],[3,2],[1,1]]
    Ans: [0, 1, 1, 2, 0]
Comments (1)