id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

findNthLeapYear


2024 is a leap year. Use recursion to find when the nth next leap year is. It is always 4 years from the previous leapyear (unless the year is divisible by 100 which it is not, but it is if it is also divisible by 400) like 2100 is not a leap year, but 2400 is. So if they put in 3, it should return 2036.


findNthLeapYear(3) → 2036
findNthLeapYear(15) → 2084
findNthLeapYear(19) → 2104

...Save, Compile, Run (ctrl-enter)

public int findNthLeapYear(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy