Solve in C#
There is a string representing a date in MMDD format, where MM denotes a
month in a twodigit format and DD denotes a day in a twodigit format. Some digits
were replaced by Replace all the question marks with digits 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 date;
that, given a string quate, returns the latest valid date as a string in the format
MMDD If it is not possible to obtain any valid date, return the string
Examples:
Assuming date the date is clearly from January or November
Only January has days, so the function should return
Assuming date the date is clearly from February which has
days. The function should return
Assuming date no month has at least days. The function should
return
Assuming date the date is not valid. There are only days in
September, so the function should return days in each month is as follows: