摘要:
1. numbers of islands 1 class Solution(object): 2 def dfs(self,grid,i,j): 3 m,n=len(grid),len(grid[0]) 4 5 for k in range(4): 6 nx,ny=i+self.dirs[k],j 阅读全文
摘要:
1.hashtable 1 class Node: 2 def __init__(self,key,val): 3 self.pair=(key,val) 4 self.next=None # next仍指向一个Node 5 6 class MyHashMap(object): 7 8 def __ 阅读全文
摘要:
1.search range 1 class Solution(object): 2 def searchRange(self, nums, target): 3 res=[-1,-1] 4 if(len(nums)==0): 5 return res 6 7 left,right=0,len(nu 阅读全文
摘要:
1. rand7生成rand10 1 # The rand7() API is already defined for you. 2 # def rand7(): 3 # @return a random integer in the range 1 to 7 4 5 class Solution( 阅读全文