Coud anyone help me to identify the error (String to integer)?


  • 0
    U

    class Solution:
    # @returns an integer
    def atoi(self, str):
    import re
    re.match(r"\s*(+|-)?\s*\d+", str)
    if result:
    return eval(result.group())
    else:
    return 0


Log in to reply
 

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