注意问题:
1)字符串是空指针的情况。
2)如果输入的是一个空字符串“”
3)所有‘0’到‘9’之外的字符都是非法的吗?加号和减号是合法输入。
4) 考虑溢出
#include
using namespace std;
bool g_value=false;
int atoi(char * number){
if(number == NULL || *nu...
分类:
其他好文 时间:
2014-07-30 17:37:04
阅读次数:
182
Problem Description
Given a positive integer n, your task is to find a positive integer m, which is a multiple of n, and that m contains the least number of different digits when represented in decim...
分类:
其他好文 时间:
2014-07-30 14:46:03
阅读次数:
230
Single Number I
问题描述:
Given an array of integers, every element appears twice except for one. Find that single one.
解题思路:
既然除了某个元素出现一次外,其他所有元素都出现两次,那么可以异或数组的所有元素,得到的结果就是我们所要找的那个元素的值。
class Solu...
分类:
其他好文 时间:
2014-07-30 12:19:53
阅读次数:
184
Find DigitsProblem StatementGiven a number you have to print how many digits in that number exactly divides that number.Input formatThe first line con...
分类:
其他好文 时间:
2014-07-30 11:55:13
阅读次数:
250
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-07-30 11:30:33
阅读次数:
247
function string10to62(number) { var chars = '0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ'.split(''), radix = chars.length...
分类:
编程语言 时间:
2014-07-30 11:27:03
阅读次数:
374
今天,和大家分享一道关于进制问题中的循环移位,大家应该知道,系统语言中提供的按位左移《和按位右移》都是非循环的。那什么叫循环移位呢?所谓循环移位是指在移位时不丢失移位前原范围的位,而是将它们作为另一端的补入位。例如循环右移n位,指各位右移n位,原来的低n位变成..
分类:
编程语言 时间:
2014-07-30 10:10:53
阅读次数:
206
大意:n次操作原串查询逆序数,求出所有串中最小的逆序数。求逆序数属于线段树的统计问题,建立空树,每次进行插点时进行一次query操作即可。n次操作可以套用结论:如果是0到n的排列,那么如果把第一个数放到最后,对于这个数列,逆序数是减少a[i],而增加n-1-a[i]。 1 #include 2 #....
分类:
其他好文 时间:
2014-07-30 09:46:43
阅读次数:
163
题目: 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...
分类:
编程语言 时间:
2014-07-30 05:34:43
阅读次数:
319
目前在Javascript中,已经存在一些标准的类,例如Date、Array、RegExp、String、Math、Number等等,这为我们编程提供了许多方便。但对于复杂的客户端程序而言,这些还远远不够。? 与Java不同,Java2提供给我们的...
分类:
Web程序 时间:
2014-07-30 03:32:43
阅读次数:
378