码迷,mamicode.com
首页 >  
搜索关键字:find peak element    ( 34692个结果
47. 数组中出现次数超过一半的数字[Number appears more than half times]
Find number which appears more than half times of array length.
分类:移动开发   时间:2014-05-27 00:16:48    阅读次数:339
LeetCode: Single Number Ⅱ
Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime ...
分类:其他好文   时间:2014-05-27 00:10:26    阅读次数:319
linux shell 脚本获取和替换文件中特定内容
1.从一串字符串中获取特定的信息要求1:获取本机IP:menu.lst为系统镜象的IP配置文件,需要从中获取到本机IP信息(从文件获取信息)1 timeout 12 default 03 4 title live5 find --set-root /casper/vmlinuz6 kernel /c...
分类:系统相关   时间:2014-05-26 23:44:19    阅读次数:585
【题解】【数组】【Leetcode】Median of Two Sorted Arrays
####Median of Two Sorted Arrays >There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overa...
分类:其他好文   时间:2014-05-26 23:13:41    阅读次数:265
最小生成树模版
克鲁斯卡尔 struct edge { int u, v, w; }e[maxn]; int f[110]; bool cmp(edge a, edge b) { return a.w < b.w; } int find(int x) { if(x != f[x]) return f[x] = find(f[x]); return f[x]; } int MST() { int...
分类:其他好文   时间:2014-05-23 02:15:51    阅读次数:267
[LeetCode]Remove Element
Remove Element...
分类:其他好文   时间:2014-05-23 02:10:01    阅读次数:230
001. 3和5的倍数
Problem 1: Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multip...
分类:其他好文   时间:2014-05-23 01:43:01    阅读次数:253
Geeks Union-Find Algorithm Union By Rank and Path Compression 图环算法
同样是查找一个图是否有环的算法,但是这个算法很牛逼,构造树的时候可以达到O(lgn)时间效率。n代表顶点数 原因是根据需要缩减了树的高度,也叫压缩路径(Path compression),名字很高深,不过其实不难理解,简单来说就是每次查找一个节点的时候,都把这一路径中的所有节点都赋予根节点作为路径。 原文没指出的地方: 也因为需要压缩,所以初始化的时候注意,不能如前面简单实用Unio...
分类:其他好文   时间:2014-05-23 00:21:42    阅读次数:305
欧拉项目004:寻找最大的回文数
Problem 4: Largest palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest pal...
分类:其他好文   时间:2014-05-22 18:48:46    阅读次数:355
LeetCode: Jump Game II [044]
【题目】 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of ju...
分类:其他好文   时间:2014-05-22 17:02:20    阅读次数:244
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!