PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|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

  • Implement stream queries and bounded-difference subarrays - Uber (medium)
  • Implement Minesweeper and Word Search - Uber (medium)
  • Implement Store Autocomplete - Uber (medium)
  • Simulate a Rank-Based Tournament - Uber (medium)
  • Implement Cache Eviction And Seat Assignment - Uber (medium)
Uber logo
Uber
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
6
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).

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.