码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
【LeetCode OJ】Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe...
分类:其他好文   时间:2015-03-31 09:17:23    阅读次数:141
LeetCode #Single Number#
解法一: 人类需要O(n)去解决问题,于是普罗米修斯不管三七二十一就偷来了Hash... Python里面内置的dic好用到不行.这里可以利用Hash把时间复杂度降到O(n),但是这种解法不满足对内存的要求... """ Programmer : EOF Code date : 2015.03.02 file : sn.py e-mail :...
分类:其他好文   时间:2015-03-31 06:50:01    阅读次数:155
【POJ】【2699】The Maximum Number of Strong Kings
网络流/最大流/二分or贪心 题目大意:有n个队伍,两两之间有一场比赛,胜者得分+1,负者得分+0,问最多有几只队伍打败了所有得分比他高的队伍? 可以想到如果存在这样的“strong king”那么一定是胜场较多的队伍……(比他赢得多的队伍num少,而他总共赢得场数times足够多,至少得满足t.....
分类:其他好文   时间:2015-03-31 00:49:35    阅读次数:140
LeetCode - Excel Sheet Column Number
和另一道题相反,把英文字母的26进制转换成10进制。思路非常清晰。public class Solution { public int titleToNumber(String s) { int ans = 0; for(int i=s.length()-1; i...
分类:其他好文   时间:2015-03-31 00:36:22    阅读次数:136
CSUOJ 1555 Inversion Sequence
1555: Inversion SequenceTime Limit:2 SecMemory Limit:256 MBSubmit:107Solved:34DescriptionFor sequence i1, i2, i3, … , iN, we set aj to be the number o...
分类:其他好文   时间:2015-03-31 00:19:26    阅读次数:300
HDU 4734 F(x)(数位DP)
Description For a decimal number x with n digits (A nA n-1A n-2 ... A 2A 1), we define its weight as F(x) = A n * 2 n-1 + A n-1 * 2 n-2 + ... + A 2 * 2 + A1 * 1. Now you are given two numbers A a...
分类:其他好文   时间:2015-03-30 23:16:06    阅读次数:357
Leetcode: Maximum Subarray
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,?1,2,1] h...
分类:其他好文   时间:2015-03-30 23:11:53    阅读次数:188
Leetcode: Maximum Product Subarray
题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest...
分类:其他好文   时间:2015-03-30 23:10:30    阅读次数:175
旋转数组中的最小值 8
基于二分法 index1为首,index2为尾,indexMid指向中间 当Number[index1]大于等于Number[index2]的条件满足时 判断index2和index1的差距是否等于1 如果相等,说明index2即为那个突变点,最小值,将index2赋给indexMid,最终返回Nu...
分类:编程语言   时间:2015-03-30 22:48:44    阅读次数:269
Lua中数据类型的源码实现
概述     在Lua中有8种基础类型:nil、boolean、number、string、userdata、function、thread和table。可以使用函数type查看某个变量或值的类型,返回相应的类型名称。像其他动态语言一样,在语言中没有类型定义的语法,每个值都携带了它自身的类型信息。下面将通过Lua 5.2.1的源码来看类型的实现。    源码实现      Lua将值表示...
分类:其他好文   时间:2015-03-30 21:15:32    阅读次数:168
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!