
845.Longest Mountain in Array
1 |
res = up = down = 0 |
893.Groups of Special-Equivalent Strings
1 |
B = set() |
905.Sort Array By Parity
1 |
s,e = 0,len(A) - 1 |
926.Flip String to Monotone Increasing
1 |
n = len(s) |
739.Daily Temperatures
1 |
n = len(T) |
42.Trapping Rain Water
1 |
left = right = water = 0 |
114.Flatten Binary Tree to Linked List
1 |
if not root: |
896.Monotonic Array
1 |
n = len(A) |
Plus One
1 |
length = len(digits) - 1 |
another way
1 |
res = [] |
Valid Sudoku
1 |
big = set() |
841.Keys and Rooms
遍历一遍,然后看能去的房间是不是所有房间
1 |
visited = [0] * len(rooms) |
946.Validate Stack Sequences
就写呗
1 |
stack, n = [], len(pushed) |
655.Print Binary Tree
1 |
if not root: return [""] |
809.Expressive Words
考虑到两个情况:
1 单个letter数小于3,那么letter应该和words中的单词相同
2 如果大于或等于3,那么letter就是连续的
1 |
def expressiveWords(self, S, words): |
844.Backspace String Compare
1 |
def helper(s): |




近期评论