摘要:
def swimInWater(self, grid): N, pq, seen, res = len(grid), [(grid[0][0], 0, 0)], set([(0, 0)]), 0 while True: T, x, y = heapq.heappop(pq) res = max(re 阅读全文
摘要:
too short a time to find the easist way of this problem, but it definately exists. brute force way of a bfs, record every state you've visit, return t 阅读全文
摘要:
class Solution: def __init__(self): self.n=None self.done=None self.remain=None self.ans=0 def collision(self,y): x=len(self.done) for i in range(len( 阅读全文
摘要:
first of all, we can prove that a exchange without any couple emerging is useless.then we can prove in a couple position like row[6]=11,row[7]=23 , it's identical to fecth 10 or 22.so this problem tu... 阅读全文