Java one line solution.


  • 1
    G
    public boolean isNumber(String s) {
            return s.trim().matches("^[+-]?(\\.\\d+|\\d+\\.?\\d*)(e[+-]?\\d+)?$");
        }
    

Log in to reply
 

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