原创 LeetCode806

 本題注意點:字符轉數值的處理,或者說ASCII碼 import numpy as np def numberOfLines(widths, S): """ :type widths: List[int] :t

原创 LeetCode876

辣雞題目,最後發現並沒有頭結點,注意快慢雙指針法(還可用於判環) def middleNode(self, head): """ :type head: ListNode :rtype:

原创 LeetCode728

本題注意點:整除用// import numpy as np def selfDividingNumbers(left, right): """ :type left: int :type right: int

原创 LeetCode883

本題注意點:二維list的騷操作, 包括① 列表生成式,② map()   理解:       ① 類比數據庫中的SELECT…FROM…WHERE,如生成100以內的完全平方數              [x * x for x in

原创 LeetCode617

本題注意點:python二叉樹類實現、類遞歸函數(self.) import numpy as np class TreeNode(object): def __init__(self, x): self.va

原创 LeetCode852

本題注意點:循環即能通過, 當然二分更快 import numpy as np def peakIndexInMountainArray(A): """ :type A: List[int] :rtype: i

原创 LeetCode476

本題注意點:二/十進制互轉、異或位運算實現0、1互轉  import numpy as np def findComplement(num): """ :type num: int :rtype: int

原创 LeetCode561

本題注意點:list的騷操作     1、sum(list)求和;     2、list[::step] 得到子列表 import numpy as np def arrayPairSum(nums): """ :ty