原创 Python, LintCode, 111. 爬樓梯

class Solution: """ @param n: An integer @return: An integer """ def climbStairs(self, n):

原创 Python, LintCode, 35. 翻轉鏈表

""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val

原创 Python, LintCode, 46. Majority Element

class Solution: """ @param: nums: a list of integers @return: find a majority number """ def major

原创 Python, LintCode, 88. Lowest Common Ancestor of a Binary Tree

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LeetCode, 66. 加一

class Solution:     def plusOne(self, digits):         """         :type digits: List[int]         :rtype: List[int]  

原创 Python, LeetCode, 3. 無重複字符的最長子串

class Solution:     def lengthOfLongestSubstring(self, s):         """         :type s: str         :rtype: int        

原创 Python, LintCode, 175. 翻轉二叉樹

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LintCode, 453. 將二叉樹拆成鏈表

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LintCode, 72. 中序遍歷和後序遍歷樹構造二叉樹

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LintCode, 469. Same Tree

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LintCode, 627. 最長迴文串

class Solution: """ @param s: a string which consists of lowercase or uppercase letters @return: the length

原创 Python, LintCode, 73. 前序遍歷和中序遍歷樹構造二叉樹

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LintCode, 41. 最大子數組

class Solution: """ @param nums: A list of integers @return: A integer indicate the sum of max subarray

原创 Python, LintCode, 480. 二叉樹的所有路徑

""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self

原创 Python, LeetCode, 20. 有效的括號

class Solution:     def isValid(self, s):         """         :type s: str         :rtype: bool         """         N =