上一页 1 ··· 9 10 11 12 13 14 15 下一页
摘要: #coding=utf-8# 递归class Solution1(object): def wiggleMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ self.res = 0 # 这是一个坑 ans = [] sel 阅读全文
posted @ 2019-03-17 13:14 AceKo 阅读(130) 评论(0) 推荐(0)
摘要: #coding=utf-8# 递归class Solution1(object): def integerBreak(self, n): """ :type n: int :rtype: int """ self.memo = [-1 for i in range(n+1)] # 将n进行分割(至少 阅读全文
posted @ 2019-03-17 13:11 AceKo 阅读(136) 评论(0) 推荐(0)
摘要: #coding=utf-8# Definition for a binary tree node.class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None# 递归cla 阅读全文
posted @ 2019-03-17 13:10 AceKo 阅读(153) 评论(0) 推荐(0)
摘要: # coding=utf-8# 递归class Solution1(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ if not co 阅读全文
posted @ 2019-03-17 13:08 AceKo 阅读(217) 评论(0) 推荐(0)
摘要: #coding=utf-8# leetcode 312 解题报告 20190307 找工作期间#解题思路# 假设初始气球的状态是 [3,1,5,8]#、顺向思维# 第一步有四个选择:3,1,5,8 ,# 第二步有三个选择:…… o(n!)# 每一步后 原问题的规模是减少了 ,但是数据的同质性却破坏了 阅读全文
posted @ 2019-03-17 13:06 AceKo 阅读(308) 评论(0) 推荐(0)
摘要: #coding=utf-8# 递归class Solution1(object): def maxCoins(self, nums): """ :type nums: List[int] :rtype: int """ self.res = 0 if not nums: return self.re 阅读全文
posted @ 2019-03-17 13:04 AceKo 阅读(185) 评论(0) 推荐(0)
摘要: class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ length = len(prices) if length <= 1: return 0 hold = 阅读全文
posted @ 2019-03-17 13:03 AceKo 阅读(469) 评论(0) 推荐(0)
摘要: #coding=utf-8# 递归1### 选与不选 经典的组合问题class Solution1(object): def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ self.res = 0 if not 阅读全文
posted @ 2019-03-17 13:00 AceKo 阅读(598) 评论(0) 推荐(0)
摘要: #coding=utf-8#点评:#递归思想加层次遍历,很经典的解题模板思想 20181220class Solution(object): def numSquares(self, n): """ :type n: int :rtype: int """ pair = (n,0) queue = 阅读全文
posted @ 2019-03-17 12:57 AceKo 阅读(150) 评论(0) 推荐(0)
摘要: #coding=utf-8# 递归版class Solution1(object): def numSquares(self, n): """ :type n: int :rtype: int """ return self.squareNum(n) def squareNum(self,n): i 阅读全文
posted @ 2019-03-17 12:57 AceKo 阅读(211) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 下一页