Tap here to switch tabs
Problem
Submissions

Problem: Strange Printer II

med
30 min
Try to solve the Strange Printer II problem.

Statement

A strange printer can print on a grid of dimensions m $ imes$ n. In each operation, the printer chooses a color and paints a solid rectangle of that color onto the grid, overwriting any colors previously present in that rectangular region. Each color can be printed at most once.

Given an m $ imes$ n integer matrix targetGrid, return true if it is possible to print targetGrid using this printer, or false otherwise.

Constraints:

  • m ==== targetGrid.length

  • n ==== targetGrid[i].length

  • 1≤1 \leq m, n ≤60\leq 60

  • 1≤1 \leq targetGrid[row][col] ≤60\leq 60

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Strange Printer II

med
30 min
Try to solve the Strange Printer II problem.

Statement

A strange printer can print on a grid of dimensions m $ imes$ n. In each operation, the printer chooses a color and paints a solid rectangle of that color onto the grid, overwriting any colors previously present in that rectangular region. Each color can be printed at most once.

Given an m $ imes$ n integer matrix targetGrid, return true if it is possible to print targetGrid using this printer, or false otherwise.

Constraints:

  • m ==== targetGrid.length

  • n ==== targetGrid[i].length

  • 1≤1 \leq m, n ≤60\leq 60

  • 1≤1 \leq targetGrid[row][col] ≤60\leq 60