We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Jumping on the Clouds
Jumping on the Clouds
Sort by
recency
|
3223 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the explanation here : https://youtu.be/GNof9B-9CN0
Recursion in python:
1) Increment jump count on every 1 occurence 2) Count zero occurences to calcutae jump between zeros 3) Increment jump count on last iteration if second last number is not 1
fun jumpingOnClouds(c: Array): Int {
}
Java Solution:
Approach: 1. Iterating from start to Total Length - 1. 2. Max Jump (start + 2) == 0? if yes add on 2 to start. 3. If != 0, Need to avoid, so add on 1 to start. 4. for each iteration jumps increments,