Simple python code! [Accepted]! { Without using any additional helper variables!! }

  • 1
    class Solution:
        # @param s, a string
        # @return a boolean
        def isNumber(self, s):
                float(s)                 # If error is shown then print False else True
                return True                
                return False

  • 0

    A python developer that doesn't immediately do this is actually a java developer in disguise. Especially since (A) no detailed specification is provided and (B) there was not an explicit ban on try-except statements.

  • 0

    I disagree, the obvious purpose is to come up with actual implementation.

Log in to reply

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