Hackerrank - Jumping on the Clouds

Hackerrank - Problem Statement

A description of the problem can be found on Hackerrank.

Solution

I created a pointer for an actual position which starts at index 0.
I always tried to jump at position i + 2. If it is not possible because of thundercloud I step at i + 1 position. I do it until the pointer is at last cloud.

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby

Leave a Reply