Uber OA | Oct 2020
Anonymous User
2707

Question - 1:

Rotate a matrix in clockwise direction without any extra space. You can't rotate the numbers on the diagonals.

It's similar to this one: https://leetcode.com/problems/rotate-image/

Question - 2:

Given a list of numbers, find all the minimum peaks in the list using the following operation.

  1. Each time you find a peak, delete it and store it to be returned at the end.

Examples:

  1. [1,4,5,3,8,6] , output = [5,4,8,6,3,1]
  • [1,4,5,3,8,6], Min peak = 5, resultant = [1,4,3,8,6]
  • [1,4,3,8,6], Min peak = 4, resultant = [1,3,8,6]
  • [1,3,8,6], Min peak = 8, resultant = [1,3,6]
  • [1,3,6], Min peak = 6, resultant = [1,3]
  • [1,3], Min peak = 3, resultant = [1]
  • [1], min peak = 1

Output = [5,4,8,6,3,1]

I found the exact question on GforG. The solution on that site works as expected for the above use-case.

Question-3:

The 3rd question: Player 1 and Player 2 are playing a game:

Given an array A, delete the adjacent pair of the same value from A at each step (A == A[i+1], remove the pair of ( i, i+1) from A). Game starts from Player 1, one step at a time. If there are no numbers to delete, the game is over. The one who takes the last step wins. The question asks to return who won.

Comments (9)