uber logo
Uber· Sr Software Engineer

Uber Sr Software Engineer hyderabad Phone Screen Round

Location
Hyderabad
Posted
20 Apr 2025
387 reads

Summary

This post details a specific coding question encountered during a phone screen round for a Senior Software Engineer position at Uber in Hyderabad.

How it went

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 |

Questions asked (1)

  1. 01

    Find Robots Matching Blocker Distance Query

    Data Structures & Algorithms · Medium

    Given a 2D map with robots ('O'), empty spaces ('E'), and blockers ('X'), and a query array representing distances to the closest blocker in four directions (left, top, bottom, right).

    The map boundaries are also considered blockers. The task is to write a function that takes the map and the query, and returns the indices of all robots that satisfy the given blocker distance query.

    Example: Map: | 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 |

    Query: [2, 2, 4, 1] (distance to left, top, bottom, right blockers respectively)

    Expected Output: Robot at index [1, 1]

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Uber recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!