Probably simplest way to solve this[pure C]


  • 0
    O
    bool isNumber(char* s) {
        char* end=s;
        strtod(s,&end);
        if(end==s) return false;
        while(*end)
            if((*end++)!=' ')return false;
        return true;
    }
    

    Some wrapper code to library function strtod.


Log in to reply
 

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