码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
Leetcode: Gray Code
题目: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of...
分类:其他好文   时间:2015-04-11 16:25:26    阅读次数:127
[LeetCode] Factorial Trailing Zeroe
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 解题思路: n!=2^x*3^y*5^z...,注意到一个2和一个5...
分类:其他好文   时间:2015-04-11 16:21:43    阅读次数:141
【剑指offer】变态跳台阶
一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。 与跳台阶不同的地方在于,加入n=5,那么这次 青蛙可以一次性跳3层,或4层,或5层。 代码实现: class Solution { public: int jumpFloorII(int number) { int sum=0; ...
分类:其他好文   时间:2015-04-11 13:23:39    阅读次数:153
【剑指offer】跳台阶
题目描述: 一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法。 代码实现: class Solution { public: int jumpFloor(int number) { if(number<=1) return 1; else return jumpF...
分类:其他好文   时间:2015-04-11 13:21:32    阅读次数:147
Max 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,...
分类:其他好文   时间:2015-04-11 13:10:37    阅读次数:84
[译]JavaScript规范-葵花宝典
原文:[译]JavaScript规范-葵花宝典【译】JavaScript规范 译自:https://github.com/airbnb/javascript 类型 原始值: 相当于传值 string number boolean null undefined var foo = 1, bar = f...
分类:编程语言   时间:2015-04-11 10:09:58    阅读次数:220
Leetcode: Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen...
分类:其他好文   时间:2015-04-11 06:35:48    阅读次数:145
LeetCode Excel Sheet Column Number 表列数
题意:天啊!我竟然看不懂题意,还去翻别人的代码才懂!给定一个字符串,求该字符串二十六进制的总值。思路:'A'~'Z'就是1到26,"AA"=26+1=27,"BA"=26*2+1=53,"CBA"=26*26*3+26*2+1。相当于321(十进制),那么就是10*10*3+10*2+1,说第3条式...
分类:其他好文   时间:2015-04-11 01:12:21    阅读次数:177
twoSum
1 package code; 2 3 /* Given an array of integers, find two numbers such that they add up to a specific target number. 4 5 The function twoSum shou...
分类:其他好文   时间:2015-04-10 23:44:22    阅读次数:160
Codeforces Round #236 (Div. 2)E. Strictly Positive Matrix(402E)
E. Strictly Positive MatrixYou have matrixaof sizen?×?n. Let's number the rows of the matrix from1tonfrom top to bottom, let...
分类:其他好文   时间:2015-04-10 22:25:42    阅读次数:209
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!