Issue with the compiler


  • 0
    V

    It seems there is some issue with the compiler.

    public class Solution {
        public boolean isNumber(String s) {
        try{
            Float.parseFloat(s);
            if(!s.matches("[e0-9]+")){
                return false;
            }
            return true;
        }catch(Exception e){
            
        }
        return false;
    }
    

    }

    This is returning "True" when s="1". But compiler is saying it returned false. I have verified with other compilers also.


  • 0

    Actually it returns false for "1 ", not for "1".


Log in to reply
 

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