leetcode Longest Common Prefix 14...
分类:
其他好文 时间:
2015-05-25 14:45:07
阅读次数:
120
Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
注意:java中字符串求长度可以用s.length()方法,但是数组求长度直接一个a.length就可以了。
思路:先求最短字符串长度,之后从第一个字符串的第...
分类:
其他好文 时间:
2015-05-25 14:35:33
阅读次数:
103
Longest Palindromic Substring
题目:
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindrom...
分类:
其他好文 时间:
2015-05-24 14:19:55
阅读次数:
146
题目链接:http://poj.org/problem?id=2533思路分析:该问题为经典的最长递增子序列问题,使用动态规划就可以解决;1)状态定义:假设序列为A[0, 1, .., n],则定义状态dp[i]为以在所有的递增子序列中以A[i]为递增子序列的最后一个数字的所有递增子序列中的最大长度...
分类:
其他好文 时间:
2015-05-23 21:13:07
阅读次数:
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 le...
分类:
编程语言 时间:
2015-05-23 10:03:37
阅读次数:
114
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 exam...
分类:
其他好文 时间:
2015-05-22 11:18:29
阅读次数:
107
Write a function to find the longest common prefix string amongst an array of strings. 1 class Solution { 2 public: 3 string longestCommonPrefix(v...
分类:
其他好文 时间:
2015-05-22 11:05:54
阅读次数:
131
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-05-22 09:22:05
阅读次数:
84
// A O(n^2) time and O(1) space program to find the longest palindromic substring#include // A utility function to print a substring str[low..high]voi...
分类:
其他好文 时间:
2015-05-22 00:28:09
阅读次数:
110
leetcode 3 – Longest Substring Without Repeating Characters
题目:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without r...
分类:
其他好文 时间:
2015-05-21 17:27:00
阅读次数:
110