04 2021 档案
摘要:# # # @param num int整型一维数组 # @param target int整型 # @return int整型 # class Solution: def threeSumClosest(self , num , target ): # write code here num.so
阅读全文
摘要:# # # @param A int整型一维数组 # @param target int整型 # @return int整型一维数组 # class Solution: def searchRange(self , A , target ): resList = [] List = [] for i
阅读全文
摘要:# class Interval: # def __init__(self, a=0, b=0): # self.start = a # self.end = b # # # @param intervals Interval类一维数组 # @return Interval类一维数组 # class
阅读全文
摘要:# # # @param m int整型 # @param n int整型 # @return int整型 # class Solution: def uniquePaths(self , m , n ): dp = [[1 for i in range(n)] for j in range(m)]
阅读全文
摘要:# # # @param x int整型 # @return int整型 # class Solution: def sqrt(self , x ): if x <= 0: return 0 r = 1 while True: b = r r = (r + x/r) / 2 if (abs(r-b)
阅读全文
摘要:# # # @param numbers int整型一维数组 # @param target int整型 # @return int整型一维数组 # class Solution: def twoSum(self , numbers , target ): res = [0,0]#保存结果 mp =
阅读全文
摘要:# # # @param x int整型 # @return int整型 # class Solution: def reverse(self , x ): flag = False if x == 0 or x == -0 : return x if x < 0: x = -x flag = Tr
阅读全文
摘要:# # # @param matrix int整型二维数组 # @return void # class Solution: def rotate(self , matrix ): count = len(matrix) if count == 1: return matrix for i in r
阅读全文
摘要:# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param root TreeNode类 # @return int整型 # class S
阅读全文
摘要:# # # @param matrix int整型二维数组 # @return int整型一维数组 # class Solution: def spiralOrder(self , matrix ): res = [] while matrix: res += matrix[0] matrix =
阅读全文
摘要:# # # @param height int整型一维数组 # @return int整型 # class Solution: def maxArea(self , height ): tempaer = 0 maxtempaer = 0 i = 0 j = len(height) - 1 if l
阅读全文
摘要:# # # @param n int整型 # @return int整型二维数组 # class Solution: def generateMatrix(self , n ): if n<= 0: return[] res = [[0 for i in range(n)] for j in ran
阅读全文
摘要:@param prices int整型一维数组 @return int整型 class Solution: def maxProfit(self , prices ): # write code here result = 0 for i in range(1, len(prices)): tmp
阅读全文
摘要:1 # 2 # 3 # @param A int整型一维数组 4 # @return int整型 5 # 6 class Solution: 7 def maxSubArray(self , A ): 8 max_sim = A[0] 9 sim = A[0] 10 if not A : 11 re
阅读全文
摘要:# class ListNode: # self.val = x # self.next = None # # # @param l1 ListNode类 # @param l2 ListNode类 # @return ListNode类 # class Solution: def mergeTwo
阅读全文
摘要:# class ListNode: # def __init__(self, x): # self.val = x # self.next = None # # # @param head ListNode类 # @return ListNode类 # class Solution: def del
阅读全文
浙公网安备 33010602011771号