
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Check Leap Year
								Certification: Basic Level
								Accuracy: 0%
								Submissions: 0
								Points: 8
							
							Write a JavaScript program to determine if a given year is a leap year. A leap year is a year that is evenly divisible by 4, except for century years (years ending in 00) which must be divisible by 400 to be a leap year.
Example 1
- Input: year = 2024
 - Output: true
 - Explanation: 
2024 is divisible by 4 (2024 ÷ 4 = 506). 2024 is not a century year (doesn't end in 00). Since it's divisible by 4 and not a century year, 2024 is a leap year. 
Example 2
- Input: year = 1900
 - Output: false
 - Explanation: 1900 is a century year (ends in 00). For century years, it must be divisible by 400 to be a leap year. 1900 ÷ 400 = 4.75, so it's not divisible by 400. Therefore, 1900 is not a leap year.
 
Constraints
- 1 ≤ year ≤ 3000
 - The input will always be a positive integer
 - Consider both regular years and century years
 - Time Complexity: O(1)
 - Space Complexity: O(1)
 
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Check if the year is divisible by 400 first - if yes, it's a leap year
 - If not divisible by 400, check if it's divisible by 100 - if yes, it's not a leap year
 - If not divisible by 100, check if it's divisible by 4 - if yes, it's a leap year
 - Use the modulo operator (%) to check divisibility
 - The order of conditions matters: check 400 first, then 100, then 4