Python solution with regex


  • 0
    E

    Using python regexp:

    if re.search('^\s*[-+]?(\d+\.?\d*|\d*\.?\d+)(e[-+]?\d+)?\s*$', s):
                return True
            return False
    

Log in to reply
 

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