Question: Solve in C# There is a string representing a date in MM - DD format, where MM denotes a month in a two

Solve in C#
There is a string representing a date in "MM-DD" format, where MM denotes a
month in a two-digit format and DD denotes a day in a two-digit format. Some digits
were replaced by "?". Replace all the question marks with digits (0-9) in such a way
as to obtain the latest possible date.
Assume that the maximum number of
Write a function:
class Solution { public string solution(string date); }
that, given a string quate, returns the latest valid date as a string in the format
"MM-DD". If it is not possible to obtain any valid date, return the string "-".
Examples:
Assuming date =?1-31", the date is clearly from January (01) or November (11).
Only January has 31 days, so the function should return "01-31".
Assuming date =02-??", the date is clearly from February (02), which has 28
days. The function should return "28-02".
Assuming date ="??-4?", no month has at least 40 days. The function should
return "-?'',
Assuming date =?**09-31, the date is not valid. There are only 30 days in
September, so the function should return "-".days in each month is as follows:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets solve this problem stepbystep We need to fill in the question marks in the given date string to ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!