摘要:
63. 不同路径 II class Solution: def uniquePathsWithObstacles1(self, obstacleGrid: List[List[int]]) -> int: m, n = len(obstacleGrid), len(obstacleGrid[0]) 阅读全文
摘要:
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. 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( 阅读全文
摘要:
class Solution { public: int longestValidParentheses(string s) { if(s.size()<2) return 0; int n=s.size(); int res=0; vector<int> dp(n,0); //dp[i]表示以nu 阅读全文
摘要:
class Solution { public: int search(vector<int>& nums, int target) { if(nums.size()==0) return -1; int left=0,right=nums.size()-1; while(left+1<right) 阅读全文