Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. ...
分类:
数据库 时间:
2015-05-24 08:53:01
阅读次数:
186
Write a SQL query to find all numbers that appear at least three times consecutively.
+----+-----+# Write your MySQL query statement below
select distinct Num from (
select
Num,
c...
分类:
数据库 时间:
2015-05-24 00:09:10
阅读次数:
217
题目链接: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
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
// 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
有两种思路:
1.从0向最大的公共前缀长度进行,i=0,即每次从0循环至strs.length,所有的字符都相等,则count++,直至有一个字符不相同为止,循环终止
2.假设 longest common prefix 等于字符串数组的最短字符串的长度,从0循环至strs.length,在前面最长公共最大长度的基础上比较相邻两个串的最大公共子串
个人感觉还是第一种思路更好,用到的额外存储空间更少,时间也更短...
分类:
其他好文 时间:
2015-05-20 11:25:46
阅读次数:
130
The diameter of a tree (sometimes called the width) is the number of nodes on the longest path between two leaves in the tree.The diameter of a tree T...
分类:
其他好文 时间:
2015-05-20 07:07:30
阅读次数:
129
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. F...
分类:
其他好文 时间:
2015-05-20 02:18:57
阅读次数:
100