Hii…
I am upsolving this question from codeforces… yesterday challenge…
https://codeforces.com/contest/1469/problem/C
I think i have found the way to check if possible or not…
But i am not able to get that how to update the maxx and minn again…
The logic is for every position i am calculating first the min and max height of ground…
Please see this…
Thanks…