Leetcode problem Reformat Date

I am new to leetcode,
And don’t know how to code in leetcode,
Please help

Is this query about Input/Output or you want solution ?

1 Like

I don’t know how to code in class

Consider you are writing in a function and instead of printing output use return.


You don’t have to. Your input will be the argument passed in the function and after processing it you have to return result.

1 Like

Please provide its solution in leetcode ide using class for reference

I just copied it, I felt that coding it will be lengthy.

 string reformatDate(string date) {
        string res;
        return res;
    string ret(string s){
        if(s=="Jan")    return "01";
        else if(s=="Feb")   return "02";
        else if(s=="Mar")   return "03";
        else if(s=="Apr")   return "04";
        else if(s=="May")   return "05";
        else if(s=="Jun")   return "06";
        else if(s=="Jul")   return "07";
        else if(s=="Aug")   return "08";
        else if(s=="Sep")   return "09";
        else if(s=="Oct")   return "10";
        else if(s=="Nov")   return "11";
        else        return "12";

feel free to ask if you didn’t understand something in this code.

1 Like

Actually i am learning CP and new to it

Please like, if it helped you. :wink:

1 Like


1 Like