Kind of cheat Python solution


  • 0
    L

    class Solution:
    # @param s, a string
    # @return a boolean
    def isNumber(self, s):

        try:
            float(s)
            return True
        except ValueError:
            return False

Log in to reply
 

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