← Questions
Leaves left in a garden after wind gusts
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A garden is a grid where each cell holds some number of leaves. A string of gusts (U, D, L, R) blows every remaining leaf one cell in that direction, and leaves blown off the edge are gone. Return how many leaves are left after all the gusts. Simulating the grid works for small inputs; the better answer tracks the net shift and the furthest it reached in each direction, then sums the surviving rectangle.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
