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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Implementation
  4. Jumping on the Clouds
  5. Discussions

Jumping on the Clouds

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • hassanmohsin
    4 years ago+ 49 comments

    My python solution

    def jumpingOnClouds(c):
        if len(c) == 1 : return 0
        if len(c) == 2: return 0 if c[1]==1 else 1
        if c[2]==1: 
            return 1 + jumpingOnClouds(c[1:])
        if c[2]==0:
            return 1 + jumpingOnClouds(c[2:])
    
    332|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature