Leap Year
In the Gregorian calendar a year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years, unless they are also divisible by 400. Return True if year is a leap year.
Example 1
year 2024
returns true
Divisible by 4, not by 100.
Example 2
year 1900
returns false
Divisible by 100 but not 400.
Constraints
1 <= year <= 9999
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Matches in a TournamentBeginner
- Number of Common FactorsBeginner
- Power of FourBeginner
- Power of ThreeBeginner
- Power of TwoBeginner
- Product Minus Sum of DigitsBeginner
- Seconds to ClockBeginner
- Staircase of StonesBeginner