问题描述: 给定一个字符串S,找出它的最大的回文子串,你可以假设字符串的最大长度是1000,而且存在唯一的最长回文子串 。 思路分析: 动态规划的思路:dp[i][j] 表示的是 从i 到 j 的字串,是否是回文串。 则根据回文的规则我们可以知道: 如果s[i] == s[j] 那么是否是回文决定于 ...
分类:
其他好文 时间:
2016-09-14 20:41:45
阅读次数:
131
题目链接: http://poj.org/problem?id=2533 Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric s ...
分类:
其他好文 时间:
2016-09-13 22:21:59
阅读次数:
177
104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from th ...
分类:
其他好文 时间:
2016-09-13 13:29:52
阅读次数:
150
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa ...
分类:
其他好文 时间:
2016-09-13 07:53:07
阅读次数:
136
以下是这段时间抽时间刷的前5题,都是自己想的解法,或许不是最优解,只是整理下,方便日后优化提升 1. Two Sum: 2. Add Two Numbers: 3. Longest Substring Without Repeating Characters: 4. Median of Two So ...
分类:
其他好文 时间:
2016-09-12 23:49:33
阅读次数:
224
Write a function to find the longest common prefix string amongst an array of strings. Solution1: 思路:没有想到什么巧妙方法。就用recursion暴力硬做。发现只要想法对,recursion怎么做都能 ...
分类:
其他好文 时间:
2016-09-12 07:21:25
阅读次数:
125
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-11 23:02:10
阅读次数:
142
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-09 22:09:12
阅读次数:
116
Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than ...
分类:
其他好文 时间:
2016-09-09 15:10:28
阅读次数:
101