Leetcode Problem 1507. Reformat Date
1507. Reformat Date
AI Mock Interview
Leetcode Solutions
String Manipulation and Mapping
Solution Idea
Algorithm Steps
Code Implementation
Complexity Analysis
Create a dictionary to map month abbreviations to their numerical string representation.
Split the input date string into day, month, and year.
Remove the ordinal suffix from the day part and pad with zero if it's a single digit.
Use the dictionary to convert the month abbreviation to a numerical string.
Concatenate the year, numerical month, and day strings with '-' separators to form the final date string in 'YYYY-MM-DD' format.
Regex and Array Indexing
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...