def myAtoi(str): s = str.strip() if not s: return 0 if s[0] in '-+': sign = {'-':-1,'+':1}[s[0]] s = s[1:] else: sign = 1 n = sign * digits2int_b(iter_digit(s)) return overflow32(n)
def atoi(str): s = str.strip() if not s: return 0 if s[0] in '-+': sign = {'-': -1, '+': 1}[s[0]] s = s[1:] else: sign = 1 n = sign * digits2int_b(iter_digit(s)) return overflow32(n)
def sumNumbers(root): return sum(digits2int_b(path) for path in iter_path(root))
def isPalindrome(x): if x < 0: return False return x == digits2int_b(int2digits(x))
def reverse(x): n = sign(x) * digits2int_b(int2digits(abs(x))) return overflow32(n, 0, 0)