码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:其他好文   时间:2015-07-12 22:58:27    阅读次数:167
[leedcode 53] 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,...
分类:其他好文   时间:2015-07-12 22:53:56    阅读次数:146
leetcode191 Number of 1 Bit
题意:一个int类型正整数,求它的二进制形式有多少个1思路:除2递归,可以解出,看了discuss里面有个解更牛,一行结束战斗,是用n&(n-1)再递归,其实并不是很懂怎么想出来这么做的,可能是自己对二进制的处理根本不怎么了解吧,但是这样做结果是对的代码:int hammingWeight(uint...
分类:其他好文   时间:2015-07-12 21:33:41    阅读次数:90
Solution 30: 从1到n出现“1”的次数
问题描述Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Retu...
分类:其他好文   时间:2015-07-12 21:30:33    阅读次数:114
C - The C Answer (2nd Edition) - Exercise 1-8
/* Write a program to count blanks, tabs, and newlines. */ #include /* count blanks, tabs, and newlines */ main() { int c, nb, nt, nl; nb = 0; /* number of blanks */ nt = 0; /* number of t...
分类:其他好文   时间:2015-07-12 20:23:41    阅读次数:103
[leedcode 52] N-Queens II
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.public class Solution { ...
分类:其他好文   时间:2015-07-12 17:01:11    阅读次数:107
Count Primes -- leetcode
Description: Count the number of prime numbers less than a non-negative number, n. 基本思路:筛法 1, 2 为素数, 筛掉以2为因子的数。 即 2 * 2, 2*3, 2*4,2*5 2, 寻找到下一个未被筛除的数,如3.  再筛掉以3为因子的数。 3, 重复步骤2. 时间复杂度为O(n) ...
分类:其他好文   时间:2015-07-12 15:42:46    阅读次数:90
Oracle自定义例外
--自定义例外create or replace procedure ex_text(spNo number) is --定义一个例外myex exception;begin --更新用户sal update emp set sal=sal+1000 where empno=spNo; --s...
分类:数据库   时间:2015-07-12 15:29:17    阅读次数:144
sql使用row_number()查询标记行号
背景: 在分页功能中,记录需分页显示,需要row_number()函数标记行号。数据表:排序之前数据表显示:sql语句:1 select ROW_NUMBER() over(order by id) as RowNum,Name,Val from T1检索结果:注意:Leslie的ID为Nul...
分类:数据库   时间:2015-07-12 10:55:02    阅读次数:237
矩阵 构造 模板
F - Number Sequence#include#includeusing namespace std;struct mat{ int ans[2][2];};mat I,MID;int M;mat cal(mat a,mat b){ mat c; int i,j,k; for(i=0;i>=...
分类:其他好文   时间:2015-07-12 10:54:37    阅读次数:137
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!