Simulate fixed-shape tiling on a grid | Uber Interview Question