PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Uber

Simulate fixed-shape tiling on a grid

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to implement grid-based simulation and pattern-matching algorithms, including handling fixed-shape placements, internal holes, bounds checking, collision detection, and explicit scanning/tie-breaking rules.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Simulate fixed-shape tiling on a grid

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You are given an empty n-by-m grid and a list of tile patterns, patterns[0..k-1]. Each pattern is a binary matrix (1 = filled cell, 0 = hole) and must be placed exactly as given—no rotation or reflection. Starting with patterns[0], for each pattern i, scan the grid in row-major order (top to bottom, left to right) to find the top-left-most position where all 1-cells of the pattern fit entirely within bounds and only cover currently empty grid cells. If a valid position exists, place the pattern there and write the integer (i + 1) into every covered cell; if no position exists, skip this pattern and continue. After processing all patterns, output the final grid as n rows and m columns, using '.' for cells that remain empty. Implement a function that performs this simulation. Clearly specify your scanning order, tie-breaking, and how you represent patterns. Discuss time and space complexity and edge cases (e.g., patterns with holes, patterns larger than the grid, overlapping attempts).

Quick Answer: This question evaluates a candidate's ability to implement grid-based simulation and pattern-matching algorithms, including handling fixed-shape placements, internal holes, bounds checking, collision detection, and explicit scanning/tie-breaking rules.

Related Interview Questions

  • Thread-Safe Token-Bucket Rate Limiter - Uber (medium)
  • Group Anagrams - Uber (medium)
  • Quadtree for 2D Geospatial Points - Uber (medium)
  • Deep Equality of Two Records - Uber (medium)
  • Shortest Path in a Grid with Blocked Cells - Uber (medium)
|Home/Coding & Algorithms/Uber

Simulate fixed-shape tiling on a grid

Uber logo
Uber
Sep 6, 2025, 12:00 AM
mediumSoftware EngineerTake-home ProjectCoding & Algorithms
8
0

You are given an empty n-by-m grid and a list of tile patterns, patterns[0..k-1]. Each pattern is a binary matrix (1 = filled cell, 0 = hole) and must be placed exactly as given—no rotation or reflection. Starting with patterns[0], for each pattern i, scan the grid in row-major order (top to bottom, left to right) to find the top-left-most position where all 1-cells of the pattern fit entirely within bounds and only cover currently empty grid cells. If a valid position exists, place the pattern there and write the integer (i +

  1. into every covered cell; if no position exists, skip this pattern and continue. After processing all patterns, output the final grid as n rows and m columns, using '.' for cells that remain empty. Implement a function that performs this simulation. Clearly specify your scanning order, tie-breaking, and how you represent patterns. Discuss time and space complexity and edge cases (e.g., patterns with holes, patterns larger than the grid, overlapping attempts).

Submit Your Answer to Earn 20XP

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 8,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
  • AI Coding 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.