Challenge Information

Title : Dying Plants
Difficulty : Hard
Solutions : 10
Maximum Score : 200
Completed by You: No
Description :

Plants are treated with some amount of pesticides in the garden. If the number of pesticides increases then, they can cause the death of plants. In a garden, after each day, if any plant has more pesticide than the plant on its left, being weaker than the left one, it dies.

The initial values of the pesticide in each of the plants are given. You have to find the number of days after which no plant dies that is, the time after which there is no plant with more pesticide content than the plant to its left.

It should return an integer indicating the number of days until plants no longer die from pesticide.

Write a function solve having the following parameter(s):
1.) arr = an array on int, the pesticide levels in each plant

Plant's pesticide levels are given as:
[2, 4, 3, 6, 2]
Output: 2

On day 1, Plants 2 and 4 dies. [2,3,6] plants left.
On day 2, Plant 3 dies, and [2,2] left.
No plants die after day 2. As there is no plant with a higher concentration of pesticide than the one to its left.