Revenge of LIS IIProblem DescriptionIn computer science, the longest increasing subsequence problem is to find a subsequence of a given sequence in wh...
分类:
其他好文 时间:
2014-11-02 12:04:13
阅读次数:
140
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
分类:
编程语言 时间:
2014-11-01 23:10:30
阅读次数:
279
题目链接:LightOJ 1269 - Consecutive Sum
题目大意:给定一个序列,选定一段区间的亦或和,输出最大和最小。
解题思路:最大很简单,对所有前缀建立字典树,然后尽量往反向走;最小则需要往正向走,并且向正向走的时候要扣
除自己本身。
#include
#include
#include
using namespace std;
const int...
分类:
其他好文 时间:
2014-10-31 01:18:57
阅读次数:
227
题目链接:poj 3764 The xor-longest Path
题目大意:给定一棵树,每条边上有一个权值,找出一条路径,使得路径上权值的亦或和最大。
解题思路:dfs一遍,预处理出每个节点到根节点路径的亦或和rec,那么任意路径均可以表示rec[a] ^ rec[b],所以问题
就转换成在一些数中选出两个数亦或和最大,那么就建立字典树查询即可。
#include
#in...
分类:
其他好文 时间:
2014-10-30 23:57:58
阅读次数:
424
Write a function to find the longest common prefix string amongst an array of strings.找出所有字符串的最长公共前缀。 1 public class Solution { 2 public String lo...
分类:
其他好文 时间:
2014-10-30 20:40:26
阅读次数:
222
Longest Ordered SubsequenceDescriptionA numeric sequence of ai is ordered if a1 File Name: poj2533.cpp 3 > Author: Enumz 4 > Mail: 369372123@...
分类:
其他好文 时间:
2014-10-30 16:56:36
阅读次数:
164
# 题目 > Given an unsorted array of integers, find the length of the longest consecutive elements sequence. > For example, > Given [100, 4, 200, 1, 3, 2], > The longest consecutive elements sequenc...
分类:
其他好文 时间:
2014-10-30 12:01:47
阅读次数:
221
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. For ...
分类:
其他好文 时间:
2014-10-30 11:46:27
阅读次数:
188
H -LISTime Limit:2000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionA numeric sequence ofaiis ordered ifa1<a2< ... <aN. Let...
分类:
其他好文 时间:
2014-10-28 23:49:45
阅读次数:
261
1, 思考过程比较慢,加强锻炼2,空字符串的定义,不能用null3,数组的长度为array.length,而string的长度为函数 string.length()public class Solution { public String longestCommonPrefix(String[...
分类:
其他好文 时间:
2014-10-27 12:37:47
阅读次数:
246