摘要:
import functools class Solution(object): @functools.lru_cache() def mergeTrees(self, t1, t2): if t1 and t2: root = TreeNode(t1.val + t2.val) root.left = self.m... 阅读全文
摘要:
按位计算就行. 阅读全文
摘要:
bin(7)Out[12]: '0b111'oct(73)Out[13]: '0o111'hex(273)Out[14]: '0x111' 阅读全文
摘要:
class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ return str(bin(x^y)).count('1') 阅读全文
摘要:
import functools # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None @functools.l... 阅读全文