Will the greedy approach work in this? In case we simply take the highest reachable state
Can greedy be used
no, greedy cannot be used, in the end of the video, when bhaiya reach 29 and make throw of 1 and then 6, what if he was at a place which could not be covered now, but due to the greedy approach he reached a substate which is less optimum
for eg, if a ladder was from 13 to 29 and that is it, here u will need total three throws
and a ladder from 17 to 25 and 26 to 36 directly, here u need only two throws
but since in greedy you would have skipped the ladder at 17 and hence on 26, you will not reach this state ever and get a wrong answer
1 Like
Ok thanks, now I got it.