Algorithm · Walmart Labs · Medium
Requirements The input is plants: List[int], a left-to-right sequence of pesticide quantities. During one day, every plant i satisfying plants[i] > plants[i-1] is removed. The removals occur simultaneously, after which the remaining plants shift together. Because it has no plant on its left, the first plant is never removed. Continue processing days until an entire day produces no removals. Return how many days passed before the arrangement became stable. Examples The first…
Checking your access…