- 博客(7)
- 收藏
- 关注
原创 0104.maximum-depth-of-binary-tree
# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: def maxDepth(self, root: TreeNode) -> int: def MaxDepth(root).
2020-07-18 17:39:42 104
原创 0088.merge-sorted-array
from typing import List#--------testcase input---------l1a = [1,2,3,0,0,0]l1b = [2,5,6]#----------------------------main function--------------------------------# V1.0 要求原地修改,从后往前比较,并从后往前插入# def merge(nums1: List[int], m: int, nums2: List[int], n:.
2020-07-03 11:22:05 118
原创 0053.maximum-sum-subarray
from typing import Listimport sys#--------testcase input---------nums1 = [-2,1,-3,4,-1,2,1,-5,4]nums2 = [1]nums3 = [-2,1]nums4 = [-1,-2]nums5 = [-1,-2,-3,-4,-5,-6,-7]nums6 = [-1,-2,-3,1,-5,-6,-7]#----------------------------main function-------.
2020-07-02 09:39:07 158
原创 0026.remove-duplicates-from-sorted-array
from typing import Listimport operator#notice:#--------input---------nums1 = [0,0,1,1,1,2,2,3,3,4]nums2 = [1]nums3 = [1,1]nums4 = [1,2]nums5 = [1,1,2,3]#----------------------------success--------------------------------#时间复杂度 O() #空间复杂度 O(1).
2020-06-20 11:22:21 111
原创 0021.MergeTwoSortedLists
#----------------------------class init--------------------------------class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = nextclass LinkList(object): def __init__(self): self.head ..
2020-06-19 16:04:10 173
原创 0001.twoSum
from typing import List#--------暴力枚举---------#时间复杂度 O(N^2)#空间复杂度 O(1)# class Solution():# def __init__(self, nums: List[int], target: int) -> List[int]: # 关于为什要用__init__,可参考https://blog.csdn.net/geerniya/article/details/77487941# se.
2020-06-18 15:21:46 93
原创 0020.ValidParentheses
from typing import List#--------input---------s = ['{[([])]}']s1 = '[)'s2 = '()'s3 = ']'#----------------------------fail--------------------------------#--fail1:[)不能过...# def isVld(s: str) -> bool:# ram = []# for x in s:# .
2020-06-18 15:17:35 111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人