Check if date is valid
Basic Accuracy: 0.0% Submissions: 2 Points: 1

Given a date, the task is to check if it is valid or not. It may be assumed that the given date is in range from 01/01/1800 to 31/12/9999 and any date not within this range will also be considered invalid.

 

Example 1:

Input:
d = 10, m = 12, y = 2000
Output:
1
Explanation:
The given date 10/12/2000 is valid.

Example 2:

Input:
d = 30, m = 2, y = 1700
Output:
0
Explanation:
The given date 30/2/1700 is invalid.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function isValidDate() which takes 3 Integers d,m and y as input and returns the answer.

 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= d, m, y <= 10000

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.