Problem 216. Is this date a palindrome?emordnilap a etad siht sI
Take a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome. A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type "help datenum").
The date shall be considered a palindrome if the "mmddyy" form of the date is a palindrome with leading zeros removed from months and days. Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33. Then the leading zeros are removed to get "3333" --> true. Date number 695118 corresponds to March 3, 1903, i.e. "030303" which reduces to "3303" --> false.
Solution Stats
Problem Comments
-
1 Comment
My solution is an abomination based on the prior leading solution. Please add more true test cases and possibly a random date.
Solution Comments
Show commentsProblem Recent Solvers65
Suggested Problems
-
Remove the small words from a list of words.
1501 Solvers
-
479 Solvers
-
Convert from Base 10 to base 5
260 Solvers
-
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
187 Solvers
-
279 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!