PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Count connected delivery zones

Last updated: Mar 29, 2026

Quick Overview

This question evaluates graph traversal and connected-components detection on grids, measuring competence in grid-based algorithms, neighbor connectivity, and algorithmic analysis of time and space complexity.

  • Medium
  • Uber
  • Coding & Algorithms
  • Machine Learning Engineer

Count connected delivery zones

Company: Uber

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Given an m x n grid representing a service area, each cell is either 'Z' (deliverable zone) or '#' (blocked). Two 'Z' cells belong to the same zone if they are 4-directionally adjacent. Implement countZones(grid: List[List[char]]) -> int that returns the number of connected zones. Follow-up: return the sizes of all zones in descending order. Analyze time and space complexity, and then optimize for minimal extra space.

Quick Answer: This question evaluates graph traversal and connected-components detection on grids, measuring competence in grid-based algorithms, neighbor connectivity, and algorithmic analysis of time and space complexity.

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
Sep 6, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
3
0

Given an m x n grid representing a service area, each cell is either 'Z' (deliverable zone) or '#' (blocked). Two 'Z' cells belong to the same zone if they are 4-directionally adjacent. Implement countZones(grid: List[List[char]]) -> int that returns the number of connected zones. Follow-up: return the sizes of all zones in descending order. Analyze time and space complexity, and then optimize for minimal extra space.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Machine Learning Engineer•Uber Machine Learning Engineer•Uber Coding & Algorithms•Machine Learning 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.