Back to problems

First Solar Panel Placement in a Binary Grid

Algorithm · Tesla · Medium

Requirements You are given a rectangular 2-D grid whose entries are either 0 or 1. A cell containing 0 is available, while a cell containing 1 is occupied by a blocker. You are also given the panel dimensions: height and width. Return the top-left coordinate of the earliest position where the entire rectangular panel fits without covering any blocker. Treat positions in row-major order: examine smaller row indices first, and within a row examine smaller column indices first.…

Checking your access…