Simple 4 line O(1) solution in Python


  • 0
    H
    class Solution(object):
        def isNumber(self, s):
            try:
                a = float(s)
                return True
            except:
                return False
    

    simple solution based on common sense.


Log in to reply
 

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