Question about my Code

  • 0

    I used this code to test on my own compiler it will be successful for all the error showing on this website, but when I put it in the website it shows me everything is wrong. So does my code have some bug on it?

    Please tell me, Thanks

    char* reverseString(char* s)
    int len = strlen(s);
    char* ret = (char*)malloc(sizeof(char) * len);
    int i = 0;
    for(i = 0; i <= len; i++)
    ret[i] = s[len - i - 1];

    return ret;


Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.