leetcode_1118
Solutions
class Solution {
public:
int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int numberOfDays(int Y, int M) {
int day = days[M - 1];
if (M == 2 && (Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0)
day++;
return day;
}
};Last updated