Very easy java solution


  • -1
    F
        public boolean isNumber(String s) {
            s = s.trim();
            try {
                Double.parseDouble(s);
            } catch (NumberFormatException e) {
                return false;
            }
            return "fdFD".indexOf(s.charAt(s.length() - 1)) < 0;
        }

Log in to reply
 

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