Problem 2198. Find my birthday
Solution Stats
Problem Comments
-
2 Comments
The answer for '29-Feb-1970' should probably be NaN
There is no 29th on February 1970. The solution is to count it as the 50th day of the year, but this should be stated at the problem description.
Solution Comments
-
1 Comment
Test 3 is riduculous. There is no Februrary 29th in 1970.
-
3 Comments
To solve the issue with the birthday year that falls on '29-Feb-1970' (and all such leap years), use the MATLAB function datestr(x) in place of x in the regexprep while condition loop to convert such b'day years to the correct '01-Mar-1970'. P.S. You can then delete the cheating section and at least get a Cody score of 26.
THX,man. But I did not know datestr have this useage. at that time I just thought this problem is flawed.and not consider this code is cheated.
PS: like the function you use( not gonna tell it for spoil-free), it is actully nice.
Problem Recent Solvers56
Suggested Problems
-
Find relatively common elements in matrix rows
1551 Solvers
-
442 Solvers
-
Find the maximum two numbers of every column of a matrix
176 Solvers
-
Sum the 'edge' values of a matrix
308 Solvers
-
Solve a System of Linear Equations
8427 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!