上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
摘要: # 首先,两条线条之间的容积为(x2 - x1) * min(height[x1], height[x2])# 先取最左边直线和最右边直线,这种情况用(0, n-1)表示。# 下一步,考虑减少一个单位的宽度的情况,这时候有两种选择:(0, n-2)和(1, n-1)。# 对比这两种情况,如果线条的高 阅读全文
posted @ 2019-03-17 14:17 AceKo 阅读(180) 评论(0) 推荐(0)
摘要: # 解题思路: 无 20190302 找工作期间class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ k = 0 if not nums: return 阅读全文
posted @ 2019-03-17 14:17 AceKo 阅读(100) 评论(0) 推荐(0)
摘要: #coding=utf-8# 解题思路:# 滑动窗口问题: 字典的使用是关键 map hash 表的使用 20190302 找工作期间class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rt 阅读全文
posted @ 2019-03-17 14:16 AceKo 阅读(149) 评论(0) 推荐(0)
摘要: # coding: utf-8'''题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。'''class Node: def __init__(self, data, left, right): self.data = data se 阅读全文
posted @ 2019-03-17 14:14 AceKo 阅读(328) 评论(0) 推荐(0)
摘要: #-*- coding:utf-8 -*-class Node: def __init__(self,data): self.data=data self.lchild=None self.rchild=Noneclass Tree: def __init__(self): self.queue=[ 阅读全文
posted @ 2019-03-17 14:13 AceKo 阅读(253) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution 阅读全文
posted @ 2019-03-17 14:12 AceKo 阅读(124) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution 阅读全文
posted @ 2019-03-17 14:11 AceKo 阅读(101) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = None# 思考误区:当只有根节点时 阅读全文
posted @ 2019-03-17 14:10 AceKo 阅读(58) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = None# 这是从底向上构建路径# 阅读全文
posted @ 2019-03-17 14:09 AceKo 阅读(75) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = None# 二叉树的公共祖先是什么? 阅读全文
posted @ 2019-03-17 14:08 AceKo 阅读(183) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页