Hey coder. We are going to discuss the problem "Frog Jump" in this article. Doesn't it sound interesting?
But before moving further you should go through the problem to understand its outline.
Important Links : Problem Link, Solution Video
Hey coder. We are going to discuss the problem "Frog Jump" in this article. Doesn't it sound interesting?
But before moving further you should go through the problem to understand its outline.
Important Links : Problem Link, Solution Video
Let us understand this problem for the input array [0,1,3,5,6,8,12,17]. According to this array, the stones are placed as shown in figure 1.
We need to find if the frog is originally at 0th stone, will it be able to reach the 17th stone.
Let's figure out how the frog must jump.
java; true";
O(n2)
The complexity is quadratic because of the use of nested loop.
O(n)
The space complexity is of order n where n= number of entries in the HashMap.
Reader, we hope you were able to clearly understand the above discussion. If you have any gaps in your understanding, we suggest you come back to this problem tomorrow.
We'll see you in the next question, goodbye.