PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Find possible robot positions

Last updated: Apr 26, 2026

Quick Overview

This question evaluates a candidate's ability to reason about grid traversal, boundary conditions, directional visibility counting, and constraint-based filtering to identify feasible positions.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Find possible robot positions

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a 2D grid where `'.'` represents an open cell and `'#'` represents a wall. A hidden robot is standing on one open cell. The robot's sensor returns four integers: `up`, `down`, `left`, and `right`. - `up`: how many open cells the robot can move upward before hitting a wall or leaving the grid - `down`: how many open cells the robot can move downward before hitting a wall or leaving the grid - `left`: how many open cells the robot can move left before hitting a wall or leaving the grid - `right`: how many open cells the robot can move right before hitting a wall or leaving the grid Write a function to return all open cells `(row, col)` that could be the robot's position given the grid and the four sensor values. Use zero-based indexing. A candidate cell is valid only if the visible open-cell counts in all four directions exactly match the given sensor readings.

Quick Answer: This question evaluates a candidate's ability to reason about grid traversal, boundary conditions, directional visibility counting, and constraint-based filtering to identify feasible positions.

Related Interview Questions

  • Implement Minesweeper and Word Search - Uber (medium)
  • Implement Store Autocomplete - Uber (medium)
  • Implement Cache Eviction And Seat Assignment - Uber (medium)
  • Schedule Non-Overlapping Meetings Efficiently - Uber (hard)
  • Evaluate an Arithmetic Expression - Uber
Uber logo
Uber
Feb 21, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0
Loading...

You are given a 2D grid where '.' represents an open cell and '#' represents a wall. A hidden robot is standing on one open cell.

The robot's sensor returns four integers: up, down, left, and right.

  • up : how many open cells the robot can move upward before hitting a wall or leaving the grid
  • down : how many open cells the robot can move downward before hitting a wall or leaving the grid
  • left : how many open cells the robot can move left before hitting a wall or leaving the grid
  • right : how many open cells the robot can move right before hitting a wall or leaving the grid

Write a function to return all open cells (row, col) that could be the robot's position given the grid and the four sensor values. Use zero-based indexing.

A candidate cell is valid only if the visible open-cell counts in all four directions exactly match the given sensor readings.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Software Engineer•Uber Software Engineer•Uber Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.