[http://poj.org/problem?id=3764] (题目链接) 今天的考试题,看到异或就有点虚,根本没往正解上想。。 题意:给出一棵带权树,请找出树上的一条路径,使其边上权值的异或和最大。 solution 首先我们考虑从根向下dfs,记录下每个点i到根上权值的异或和val[i]。根 ...
分类:
其他好文 时间:
2016-09-28 15:53:07
阅读次数:
166
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two ...
分类:
其他好文 时间:
2016-09-27 13:08:46
阅读次数:
132
本问题是求最长不重复子串。 给出一种方法: 例如:aplsdfgsjiuk,设置一个最长子串的起始位和结束位,a为起始位,b为结束位,当遍历aplsdfg时,下一位s重复,所以可以从d为起始位置在遍历。 时间复杂度为O(n)。 ...
分类:
其他好文 时间:
2016-09-27 11:29:14
阅读次数:
95
找到提供的句子中最长的单词,并计算它的长度。 函数的返回值应该是一个数字。 ...
分类:
其他好文 时间:
2016-09-26 17:41:25
阅读次数:
97
题目来自 https://leetcode.com/problems/longest-palindromic-substring/ 题目:Given a string S, find the longest palindromic substring in S. You may assume tha ...
分类:
其他好文 时间:
2016-09-25 17:26:09
阅读次数:
149
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2016-09-24 23:20:25
阅读次数:
137
P1458 顺序的分数 Ordered Fractions P1458 顺序的分数 Ordered Fractions P1458 顺序的分数 Ordered Fractions 151通过 203提交 题目提供者该用户不存在 标签USACO 难度普及- 提交 讨论 题解 最新讨论 暂时没有讨论 题 ...
分类:
其他好文 时间:
2016-09-24 13:36:47
阅读次数:
141
Verrazano, an Italian about whom little is known, sailed into New York Harbour in 1524 and named it Angouleme. He described it as 'a very agreeable si ...
分类:
其他好文 时间:
2016-09-24 13:26:29
阅读次数:
114
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 longes ...
分类:
其他好文 时间:
2016-09-24 11:54:09
阅读次数:
132