码迷,mamicode.com
首页 >  
搜索关键字:voting algorithm    ( 11828个结果
[leetcode] Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorte...
分类:其他好文   时间:2014-07-07 16:53:17    阅读次数:196
Problem Best Time to Buy and Sell Stock III
Problem Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit...
分类:其他好文   时间:2014-07-07 16:05:24    阅读次数:229
Problem Best Time to Buy and Sell Stock 11
Problem Description:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit...
分类:其他好文   时间:2014-07-07 15:24:41    阅读次数:212
【hoj】1604 cable master
简单,二分法,但是在oj上交的时候会有精度的限制,所以只能把数扩得大一点,而且在扩的时候为防止尾数会自动生成一些非零数,所以还是自己吧扩到的位置设置为0,还有输出时因为%.2lf会自己有4设5入,所以可以自己算出小数点后两位的数值,在输出,保证要求的精度 #include #include #include #define MAX 10010 using namespace std; l...
分类:其他好文   时间:2014-07-01 06:35:11    阅读次数:238
Single Number
题目 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it witho...
分类:其他好文   时间:2014-07-01 06:24:42    阅读次数:204
Single Number II
题目 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 complexity. Could you implement it...
分类:其他好文   时间:2014-07-01 06:23:24    阅读次数:334
Single Number
题目 Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it witho...
分类:其他好文   时间:2014-06-30 19:38:37    阅读次数:226
Single Number II
题目 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 complexity. Could you implement it...
分类:其他好文   时间:2014-06-30 19:23:18    阅读次数:200
【hoj】1604 cable master
简单,二分法,但是在oj上交的时候会有精度的限制,所以只能把数扩得大一点,而且在扩的时候为防止尾数会自动生成一些非零数,所以还是自己吧扩到的位置设置为0,还有输出时因为%.2lf会自己有4设5入,所以可以自己算出小数点后两位的数值,在输出,保证要求的精度 #include #include #include #define MAX 10010 using namespace std; l...
分类:其他好文   时间:2014-06-30 19:02:41    阅读次数:163
【剑指offer】Q29:数组中出现次数超过一半的数字
就本题而言,个人觉得练习下partition函数是有必要的,毕竟它是快速排序的核心,是基础性的东西,也是必须要掌握的,至于书中给出的“取巧”性解法,是属于个人思维能力的考察,是一种考虑问题的思路,不是一两个问题就能练就的。 partition函数,包括快速排序,是一定要信手拈来的,必须的。 import random def MoreThanHalf(array): if len(array...
分类:其他好文   时间:2014-06-30 15:50:52    阅读次数:225
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!