码迷,mamicode.com
首页 >  
搜索关键字:consecutive numbers    ( 8082个结果
Decode Ways
Description:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded m...
分类:其他好文   时间:2014-08-01 04:39:01    阅读次数:167
LeetCode 第一题,Two Sum
题目还原 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 t...
分类:其他好文   时间:2014-08-01 02:25:11    阅读次数:391
Longest Consecutive Sequence
其实网上关于leetcode的题目的答案已经相当多了,这也是为啥我自己不把每道题目都贴出来的原因,觉得分析得没人好,代码也没别人的精简。不过,这道题目看到网上有不少做法跟实际要求的O(n)复杂度不太符合,所以特别粘贴出来,也正好记录下自己的一些想法。   说实话,在第二遍做这道题目的时候,我还是没能够把最为完善的解法想出来,能够想到的是利用hash表以序列值为key,1(只是简单做个标记)为v...
分类:其他好文   时间:2014-07-31 21:01:41    阅读次数:165
Uva10290 - {Sum+=i++} to Reach N
Problem H {sum+=i++} to Reach N Input: standard input Output:  standard output Memory Limit: 32 MB   All the positive numbers can be expressed as a sum of one, two or more consecutive positive i...
分类:其他好文   时间:2014-07-31 20:58:37    阅读次数:199
Leetcode--Two Sum
Problem Description: 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...
分类:其他好文   时间:2014-07-31 20:48:17    阅读次数:215
Leetcode--Add Two Numbers
Problem Description: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbe...
分类:其他好文   时间:2014-07-31 20:47:17    阅读次数:215
How many Fibs?(高精度)
Description Recall the definition of the Fibonacci numbers:  f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n>=3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range...
分类:其他好文   时间:2014-07-31 17:11:07    阅读次数:325
HDU - 1394 Minimum Inversion Number (线段树求逆序数)
Description The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the ...
分类:其他好文   时间:2014-07-31 13:31:46    阅读次数:229
HDU 2141 Can you find it?
Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbe...
分类:其他好文   时间:2014-07-31 12:54:46    阅读次数:704
PHP Functions - arsort()
1 f [4] => e [3] => d [2] => c [1] => b [0] => a ) 9 */10 11 12 13 $numbers = array(1,2,3,4,5,6,7,8);14 arsort($numbers);15 print_r($numbers);16 /*...
分类:Web程序   时间:2014-07-31 12:48:36    阅读次数:222
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!