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 +