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 longes...
分类:
其他好文 时间:
2015-07-11 09:00:02
阅读次数:
101
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-07-11 06:43:10
阅读次数:
124
Maximum Depth of Binary Tree (DFS, TREE)Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path fr...
分类:
其他好文 时间:
2015-07-10 13:17:22
阅读次数:
99
3 Longest Substring Without Repeating Characters链接:https://leetcode.com/problems/longest-substring-without-repeating-characters/
问题描述:
Given a string, find the length of the longest substring withou...
分类:
其他好文 时间:
2015-07-10 09:34:17
阅读次数:
134
Description:Write a SQL query to find all numbers that appear at least three times consecutively.+----+-----+| Id | Num |+----+-----+| 1 | 1 || 2 ...
分类:
其他好文 时间:
2015-07-10 02:13:08
阅读次数:
200
1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 int len = s.length(), m = 0, l = 0, p[256] = { 0 }; 5 f...
分类:
编程语言 时间:
2015-07-10 02:11:53
阅读次数:
139
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-07-09 17:29:41
阅读次数:
106
题目要求判断最长的回文,有两种思路可供选择。
思路一,从两头进行判断,定义两个指针start_index和end_index分别指向头部和尾部,首先固定start_index,让end_index从最后一个元素向前遍历,直到碰到start_index,其间对start_index到end_index的范围进行回文判断,回文判断的规则很简单,如果start和end指向的元素一样,回文长度length=2,然后start+1,end-1,继续比较,如果符合则继续+2,直到start<end不再满足,注意在这之中...
分类:
其他好文 时间:
2015-07-09 14:34:42
阅读次数:
89
题目:
Write a function to find the longest common prefix string amongst an array of strings.
题意:
写出一个函数,找到一组数组中的最长公共子串。
算法分析:
需要构建两重循环。第一层是最短子串的长度,另一层是遍历字符串数组中的每个成员。
brute force的想法,以第一个字符串为标准,对于...
分类:
编程语言 时间:
2015-07-09 13:17:56
阅读次数:
138
Longest Consecutive Sequence
分类:
其他好文 时间:
2015-07-08 22:15:54
阅读次数:
137