about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy