Wrong output on OJ!

  • 0

    Following is my code . On my Desktop Eclipse returns "true" for Input String "3" but on OJ it is returning false.

    public boolean isNumber(String s) {
    String regex = "-?(\\d*(\\.\\d+)?)(\\d)*?(([e|e-|e+])?([0-9])+)??[f]??(?!\\D)";
    Pattern pattern = Pattern.compile(regex);
    Matcher match = pattern.matcher(s);
    return match.matches();

    Is anyone experiencing the same error?

Log in to reply

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