Uber Sr Software Engineer hyderabad Phone Screen Round

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-04-20Added By Anonymous
Source: Link

Company: Uber

Role: Senior Software Engineer

Interview Stage: Phone Screen

Location: Hyderabad


Original Post Content:


Given two inputs,

First input is the location map, a 2D array


| O | E | E | E | X |

| E | O | X | X | X |

| E | E | E | E | E |

| X | E | O | E | E |

| X | E | X | E | X |


O = Robot, E = Empty, X = Blocker


Second input is the query. It’s a 1D array consisting of distance to the closest blocker in the order from left, top, bottom and right


[2, 2, 4, 1] -> This means distance of 2 to the left closest blocker, 2 to the top closest blocker, 4 to the bottom closest blocker and 1 to the right closest blocker


Note: The location map boundary is also considered blocker, meaning if the robot hits the boundary it also means it’s hitting the blocker.


Write a function that takes these two inputs and returns the index of the robots (if any) that matches the query that we’re looking for.


Example -


Solution for the example above would be the robot located at index [1, 1]


| O | E | E | E | X |

| E | >O< | X | X | X |

| E | E | E | E | E |

| X | E | O | E | E |

| X | E | X | E | X |

Comments