摘要: 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 阅读全文
posted @ 2018-09-07 17:34 Cloud.9 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2018-09-07 13:24 Cloud.9 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 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( 阅读全文
posted @ 2018-09-07 11:21 Cloud.9 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2018-09-07 10:39 Cloud.9 阅读(176) 评论(0) 推荐(0) 编辑