You are given a year in the form of an integer 'N', and your task is to check whether the given year is a leap year or not.
Note:
1) A year is said to be a leap year if it has 366 days. Normal years have 365 days.
2) The integer 'N' does not contain any leading zeros.
The first line of the input contains an integer T denoting the number of test cases.
The first and the only line of each test case contains an integer 'N', denoting the year.
Output Format:
For each test case, return “Yes” if the input year is a leap year otherwise “No”.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 100
1000 <= N <= 9999
Time limit: 1 sec
2
2000
2020
Yes
Yes
In test case 1, The year 2000 had 366 days since there were 29 days in the month of February in the year 2000.
In test case 2, The year 2020 had 366 days since there were 29 days in the month of February in the year 2020.
2
1000
1600
No
Yes
In test case 1, The year 1000 had 355 days since there were 28 days in the month of February in the year 1000.
In test case 2, The year 1600 had 366 days since there were 29 days in the month of February in the year 1600.
Use basic maths to find out something common in the leap years (Apart from the thing that they all have 366 days).
O(1),
Since all operations are performed in constant time. Thus the time complexity will be O(1).
O(1)
Since we are using constant extra memory. Thus the space complexity will be O(1).