Hello there,
I am unable to come with a sloution can you explain me with code in short
LADDER-1 unable to get the solution
hey @sohampatil_sp we will solve this problem using dp,so lets say that we have x ways of reaching i, then we can also reach i+1 to i+k in x ways, so we will add dp[i+1] to dp[i+k] with dp[i] and we will only do that when i is not a snake.
Here is code of this approach
1 Like