Panda Guru LogoPanda
Guru

Uber OA | USA

Round 1

Questions:

  1. Very simple prefix sum problem. Return the first index i where arr[0...i] >= target.
  2. You are given an array and pattern. pattern[i] can only be 1, 0 or -1.
    • if Pattern[i] == 1, it means arr[i] should be greater than arr[i-1]
    • if Pattern[i] == 0, it means arr[i] should be equal to arr[i-1]
    • Pattern[i] == -1, it means arr[i] should be less than arr[i-1]
    • Find the number of subarrays in the array where this pattern is satisfied.
  3. Find the longest path in the matrix of the sequence 1, 2, 0, 2, 0, 2, 0
    • You can only traverse in only 4 possible diagonal positions.
    • Hint: If you want to solve, this may be do Leetcode 2658 using DFS first.
  4. You need to write a function flipNumber(321), which will take a number x and return it from right to left and remove leading 0s for example flipNumber(100) = 1.
    • Now, given an array of numbers greater than zeros, find number of pairs i <= j such that arr[i] + flipNumber(arr[j]) == flipNumber(arr[i]) + arr[j].
    • Hint: Think of the equation in this way arr[i] - flipNumber(arr[i]) == arr[j] - flipNumber(arr[j]).
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.