尽量抽空刷LeetCode,持续更新 刷题记录在github上面,https://github.com/Zering/LeetCode 2016-09-05 300. Longest Increasing Subsequence 问题:https://leetcode.com/problems/lo ...
分类:
其他好文 时间:
2016-09-05 12:20:18
阅读次数:
119
该算法的定义是:给出一个int序列,元素有正有负,找出其中的最大连续子序列的和。 例如:-2,11,-4,13,-5-2,;最大和为20(11,-4, 13)。 怎么考虑这个问题呢? 要充分利用,连续,这个条件。 连续子序列的和可能为正,也可能为负。如果为正,那么我们要继续加下去,因为如果后面一个数 ...
分类:
其他好文 时间:
2016-09-05 10:34:10
阅读次数:
133
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l ...
分类:
其他好文 时间:
2016-09-04 23:58:10
阅读次数:
267
标签: 动态规划 描述: Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Clarification ...
分类:
其他好文 时间:
2016-09-04 12:53:56
阅读次数:
182
标签:动态规划 题目描述: Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. 解题思路: 这一题是非常经典的动态规划问题,在解题思路上可以按 ...
分类:
其他好文 时间:
2016-09-04 07:56:22
阅读次数:
157
Give an integer array,find the longest increasing continuous subsequence in this array. An increasing continuous subsequence: Can be from right to lef ...
分类:
其他好文 时间:
2016-09-04 01:35:48
阅读次数:
128
14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. 找出字符串集合的最长公共前缀。 思路:先计算出前两个字符串的最长公共前缀s ...
分类:
其他好文 时间:
2016-09-03 16:26:54
阅读次数:
130
原题链接:http://poj.org/problem?id=2739 题意:问一个数有几种方法用连续的素数和表示。 分析:其实就是很简单,先打表,然后对prime数组跑一波尺取法,如果==n就ans++。 代码: ...
分类:
其他好文 时间:
2016-09-03 06:20:26
阅读次数:
155
Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any ...
分类:
其他好文 时间:
2016-08-31 08:22:31
阅读次数:
191