Chef and His Garden

please post the editorial of Chef and His Garden

This problem can be solved using Linear inequality
Suppose there are 3 tree 
initial height   speed
2                  1
2                  3
2                  2
there can be 2 possibilities to be trees in zig-zag sequence 
h1 > h2 < h3
h1 < h2 > h3
Suppose after n unit time , they will be in zig-zag sequence
after n unit time height of the tree = speed*time + initial height
for first possibility 
equations will be
n+2>3*n+2 -> n<0 invalid condition
3*n+2<2*n+2 ->  n<0 invalid condition
take intersection of all sol , say it sol1 

For second possibility
equations will be 
n+2 < 3*n+2 -> n>0 valid condition
3*n+2 > 2*n + 2 n>0 valid condition
take intersection of all sol n>0 ,say it sol2

finally take union of sol1 and sol2
ans will be n>0
ans = [1,INF]

You can also refer to my solution