Regex - Java - Run on O(n)


  • 0
    L
    public class Solution {
        public boolean isNumber(String s) {
            
            return s.matches("(\\s+)?[-+]?((((\\d+(\\.)?(\\d+)?[e][-+]?)?|((\\d+)?\\.\\d+[e][-+]?)?)\\d+)|(\\d+(\\.\\d+)?)|(\\d+\\.)|(\\.\\d+))(\\s+)?");   
        }
    }
    

Log in to reply
 

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