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
|
3274 Discussions
|
Please Login in order to post a comment
Python:
My C++ Solution:
Key factor - as per the task, the player always reaches the end. so he either jump 2 positions, or jumps 1 position if 2 lands on a thunder cloud. We try to jump 2 positions, if its a thunder cloud - we return 1 back to a guaranteed safe space. Looping until less than c.size() - 1, as the c.size() -1 is considered finish and player doesnt jump after landing there.
// public static int jumpingOnClouds(List c) {
give me your opinion please i need it