Uber Technical Interview Experience (L4)

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-05-21Added By Anonymous
Source: Link

Company: Uber

Role: software engineer ii


Original Post Content:


Question

you have a grid with 3 type of elements O, X, E.

O denotes robot

X denotes blocker

E denotes empty space

grid is of size M x N.

you are also given an array of size 4 with [L, T, B, R] which represents the closest blocker at distance L from left of robot, distance T from Top of robot, distance B from bottom of robot, distance R from right of robot. boundary outside matrix is considered as blocker.

give the position of the robot which satisfies given criteria if there is one, else return [-1, -1]

closest blocker should absolutely exist at given position L, T, B, R. if it does not, it's not valid robot.

```

grid = [

['E', 'X', 'E', 'E'],

['O', 'E', 'X', 'E'],

['E', 'E', 'E', 'X'],

['X', 'E', 'E', 'E']

]

blockers = [1, 1, 1, 1]

```

Verdit: Not selected

Comments