
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Check if a Given Year is a Leap Year
								Certification: Basic Level
								Accuracy: 36.19%
								Submissions: 105
								Points: 5
							
							Write a Python program that determines whether a given year is a leap year.
Example 1
- Input: year = 2020
 - Output: True
 - Explanation: 
- Step 1: Check if the year is divisible by 4.
 - Step 2: 2020 is divisible by 4 (2020 ÷ 4 = 505 with no remainder).
 - Step 3: Check if the year is divisible by 100.
 - Step 4: 2020 is not divisible by 100 (2020 ÷ 100 = 20.2 with a remainder).
 - Step 5: Since 2020 is divisible by 4 but not by 100, it is a leap year.
 - Step 6: Return True.
 
 
Example 2
- Input: year = 1900
 - Output: False
 - Explanation: 
- Step 1: Check if the year is divisible by 4.
 - Step 2: 1900 is divisible by 4 (1900 ÷ 4 = 475 with no remainder).
 - Step 3: Check if the year is divisible by 100.
 - Step 4: 1900 is divisible by 100 (1900 ÷ 100 = 19 with no remainder).
 - Step 5: Since 1900 is divisible by 100, check if it's also divisible by 400.
 - Step 6: 1900 is not divisible by 400 (1900 ÷ 400 = 4.75 with a remainder).
 - Step 7: Since 1900 is divisible by 100 but not by 400, it is not a leap year.
 - Step 8: Return False.
 
 
Constraints
- 1 ≤ year ≤ 10^5
 - 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
- A year is a leap year if: (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0)
 - Century years must be divisible by 400