HackerRank: Jumping on the Clouds (Easy) [Javascript]

Link to code challenge
function jumpingOnClouds(c) { let jumps = 0; let cloud = 0; while (cloud < c.length - 1) { if (c[cloud + 2] !== 1) { cloud += 2; } else cloud++; jumps++; } return jumps; }

Comments

Popular posts from this blog

Code Wars: Data Reverse (6 kyu)

Code Wars: longest_palindrome (6 kyu)

Code Wars: Find the odd int