Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl ...
分类:
其他好文 时间:
2018-07-10 22:07:33
阅读次数:
153
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 ...
分类:
其他好文 时间:
2018-07-10 00:37:31
阅读次数:
149
原题网址:https://www.lintcode.com/problem/longest-increasing-subsequence/description 描述 给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。 描述 描述 给定一个整数序列,找到最长上升子序列(LIS),返回 ...
分类:
其他好文 时间:
2018-07-09 17:52:55
阅读次数:
177
编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 示例 2: 说明: 所有输入只包含小写字母 a-z 。 分析:这道题要求输出一个字符串的最长公共前缀。公共前缀的长度一定小于等于该数组中最字符串的长度,所以我们需要找到数组中长度最短的字符串当作参照 ...
分类:
编程语言 时间:
2018-07-08 22:09:15
阅读次数:
153
565. Array Nesting A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = { ...
分类:
其他好文 时间:
2018-07-08 21:15:10
阅读次数:
183
描述 In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metal ...
分类:
其他好文 时间:
2018-07-08 01:01:28
阅读次数:
172
Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combination, it ...
分类:
其他好文 时间:
2018-07-07 22:19:36
阅读次数:
133
描述Given a string containing just the characters ’(’ and ’)’, find the length of the longest valid (wellformed) parentheses substring.For ”(()”, the l ...
分类:
其他好文 时间:
2018-07-05 21:29:02
阅读次数:
131
【题目链接】 http://poj.org/problem?id=3764 【算法】 首先,我们用Si表示从节点i到根的路径边权异或和 那么,根据异或的性质,我们知道节点u和节点v路径上的边权异或和就是Sx xor Sy 问题就转化为了 : 在若干个数中,找到两个数异或的最大值,可以用Trie树加速 ...
分类:
其他好文 时间:
2018-07-01 19:27:12
阅读次数:
141
2018-06-29 22:56:24 问题描述: 问题求解: 本题是一条字符串问题,且是求Optimal,自然最初想到的是使用DP来进行求解,但是问题就是如果采用DP的话,前一个状态也太多了,和替换了多少了k值相关,因此从这个角度来说,使用DP来处理本题是不太合适的。 那么,另一个处理的手段滑动窗 ...
分类:
其他好文 时间:
2018-06-30 00:24:15
阅读次数:
164