Algorithm · LinkedIn · Medium
A garden row is represented by a binary array slots. A 1 means the plot is already occupied by a plant, and a 0 is an empty spot where you could plant. The rule is strict: no two plants (old or new) may sit side‑by‑side. You are given the initial row (slots) and then a series of queries. For each query you receive an integer n; the question is whether you can place at least n new plants in the currently empty positions – without removing or relocating any existing plant. You…
Checking your access…