摘要:
class Solution: def hasPath(self, matrix, rows, cols, path): assistMatrix = [True]*rows*cols for i in range(rows): for j in range(cols): if(self.ha... 阅读全文
posted @ 2018-10-25 10:48
findtruth123
阅读(1395)
评论(0)
推荐(0)
摘要:
def aa(nums): if not nums: return False left,right=0,len(nums)-1 while nums[left]>=nums[right]: if right-left==1: return nums[right] mid=int((... 阅读全文
posted @ 2018-10-25 10:09
findtruth123
阅读(258)
评论(0)
推荐(0)
摘要:
def fib(n): a,b=0,1 for i in range(n): b,a=a+b,b yield b print([n for n in fib(10)]) 阅读全文
posted @ 2018-10-25 09:51
findtruth123
阅读(209)
评论(0)
推荐(0)
摘要:
class myqueue(object): def __init__(self): self.stack=[] self.stack2=[] def push(self,values): for i in values: self.stack.append(i) ... 阅读全文
posted @ 2018-10-25 09:44
findtruth123
阅读(167)
评论(0)
推荐(0)
摘要:
class ListNode(object): def __init__(self,x): self.val=x self.next=None class Link(object): def __init__(self,values=None): self.nodes=self.set_link(values) i... 阅读全文
posted @ 2018-10-25 09:38
findtruth123
阅读(230)
评论(0)
推荐(0)
摘要:
print('dd dd add'.replace(' ','dd')) 阅读全文
posted @ 2018-10-25 09:27
findtruth123
阅读(174)
评论(0)
推荐(0)
摘要:
def find_integer(matrix, num): """ :param matrix: [[]] :param num: int :return: bool """ if not matrix: return False rows, cols = len(matrix), len(matrix[0]) r... 阅读全文
posted @ 2018-10-25 09:22
findtruth123
阅读(186)
评论(0)
推荐(0)
摘要:
def aa(nums): if not nums: return False hashes={} ret=[] for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 if hashes[s] >1: ret.append(s... 阅读全文
posted @ 2018-10-25 09:20
findtruth123
阅读(873)
评论(0)
推荐(0)
摘要:
class singleTon(object): def __init__(self,x): self.val=x single2=singleTon(2) a=single2 b=single2 print(a==b) print(a.val) a.val=334 print(b.val) 阅读全文
posted @ 2018-10-25 09:14
findtruth123
阅读(176)
评论(0)
推荐(0)
摘要:
class aa(object): def __init__(self,x): self.val=x def __add__(self,other): x=self.val-other.val return x a=aa(10) b=aa(2) c=b+a print(c)... 阅读全文
posted @ 2018-10-25 09:11
findtruth123
阅读(171)
评论(0)
推荐(0)