2 ms·
Yes, a YYYY-MM-DD format palindrome date that is also a palindrome in DD-MM-YYYY and MM-DD-YYYY formats cannot have more than two distinct digits. Let us repre
by susam 7y ago
Yes, a YYYY-MM-DD format palindrome date that is also a palindrome in DD-MM-YYYY and MM-DD-YYYY formats cannot have more than two distinct digits.
Let us represent the 8 digits of such a date (in YYYY-MM-DD format) as abcd-ef-gh.
Since abcd-ef-gh (i.e., YYYY-MM-DD format) is a palindrome, we get a = h, b = g, c = f, and d = e.
Since ef-gh-abcd (i.e., MM-DD-YYYY format) is a palindrome, we get a = h, b = g, c = f, and d = e.
Since gh-ef-abcd (i.e., DD-MM-YYYY format) is a palindrome, we get a = f, b = e, c = h, and d = g.
Combining all of these, we get a = c = f = h and b = d = e = g.
Therefore, such a date must be of the format abab-ba-ba, i.e., it may have a maximum of only two distinct digits.