1 class Solution { 2 public: 3 int hammingWeight(uint32_t n) { 4 int result = 0; 5 while (n > 0) { 6 if (n & 1) { 7 ...
分类:
其他好文 时间:
2015-03-21 11:10:00
阅读次数:
147
Maximum Product Subarray问题:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, gi...
分类:
其他好文 时间:
2015-03-21 11:03:59
阅读次数:
135
Minimum Inversion Number(线段树单点更新+逆序数)
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
The inversion number of a given number se...
分类:
其他好文 时间:
2015-03-20 22:10:57
阅读次数:
145
题目10:计算两百万以下所有质数的和。
10以下的质数的和是2 + 3 + 5 + 7 = 17.
找出两百万以下所有质数的和。
源码
STDMETHODIMP COuLa::Test10(int number)
{
// TODO: 在此添加实现代码
__int64 sum = 2;
for(int i = 2; 2*i-1 <= number; i++)
{...
分类:
其他好文 时间:
2015-03-20 22:06:50
阅读次数:
130
题目链接:Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations pe...
分类:
其他好文 时间:
2015-03-20 22:02:24
阅读次数:
119
Number of 1 Bits Total Accepted: 10567 Total Submissions: 28552 My Submissions Question Solution
Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known...
分类:
其他好文 时间:
2015-03-20 20:33:07
阅读次数:
100
定义子程序: 要定义自己的子程序,可使用关键字sub,子程序名(不包含与号)以及用花括号封闭起的代码块,例如:1 sub marine{2 $n +=1; #全局变量 $n3 Print “Hello,sailor number $n \n”;4 } 子程序不需要事先声明 ...
分类:
其他好文 时间:
2015-03-20 20:13:34
阅读次数:
123
标题:Combination Sum II通过率:25.1%难度:中等Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the cand...
分类:
其他好文 时间:
2015-03-20 20:07:07
阅读次数:
111
Account Number: Bank Name: ...
分类:
Web程序 时间:
2015-03-20 18:30:42
阅读次数:
193
两个Date类型字段:START_DATE,END_DATE,计算这两个日期的时间差(分别以天,小时,分钟,秒,毫秒):天:ROUND(TO_NUMBER(END_DATE - START_DATE))小时:ROUND(TO_NUMBER(END_DATE - START_DATE) * 24)分钟...
分类:
数据库 时间:
2015-03-20 18:03:36
阅读次数:
176