
LeetCode
文章平均质量分 78
G1036583997
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 292 Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the原创 2015-11-12 10:58:12 · 1019 阅读 · 0 评论 -
[LeetCode 128] - 最长连续序列(Longest Consecutive Sequence)
转载自http://www.cnblogs.com/shawnhue/archive/2013/05/26/leetcode_128.html?utm_source=tuicool&utm_medium=referral 问题 给出一个未排序的整数数组,找出最长的连续元素序列的长度。 如: 给出[100, 4, 200, 1, 3, 2], 最长的连续元素序列是[1,转载 2017-02-06 09:05:24 · 1105 阅读 · 1 评论 -
Moore's voting algorithm
注: 若从数组中找出出现大于1/3元素个数的元素。 则:有2(3-1)个候选者,3个不同的数字抵消。剩下的候选者统计个数,若大于1/3元素个数则取出。代码最后面贴出。 若从数组中找出出现大于1/k元素个数的元素。 则:有k-1个候选者,k个不同的数字抵消。剩下的候选者统计个数,大于1/k元素个数的取出。 转载自:http://blog.youkuaiyun.com/chfe007/article转载 2017-02-03 11:49:49 · 495 阅读 · 0 评论