水题。数字一共就9个,去掉1是用来显示标点的,剩下8个。
穷举一下map,然后有几个数字,就输出这几个数字的排列,是一个dfs嘛。
map num;
void allCombinations(string &digits, int start, int len, string &pres, vector &res){
if(len == digits.length()){
...
分类:
其他好文 时间:
2014-05-15 01:42:26
阅读次数:
264
Humble Numbers
题目描述
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the fi...
分类:
其他好文 时间:
2014-05-15 01:36:22
阅读次数:
230
Single Number II
Total Accepted: 14472 Total
Submissions: 44420My Submissions
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Y...
分类:
其他好文 时间:
2014-05-15 01:23:42
阅读次数:
273
Description
Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the Universit...
分类:
其他好文 时间:
2014-05-15 00:20:39
阅读次数:
332
JS异常try { var n = prompt("Please enter a
positive number"); var f = factorial(...
分类:
编程语言 时间:
2014-05-14 23:46:00
阅读次数:
405
第三道树的题目,我还是不会,我擦,怎么递归算法还是不能很好理解。看来还得好好研究下递归算法。题目:求一棵树的最大深度。思路:递归地求取左子树最大深度
和 右子树最大深度,返回较大值即为 整棵树的 最大深度。代码:public int maxDepth(TreeNode root) { ...
分类:
其他好文 时间:
2014-05-14 23:07:14
阅读次数:
373
大部分的应用中的大部分的实体类型对象都可以使用key-value被序列化到JSON中。key就是field的name或这property,value是string,number,boolean,另外的对象,数组,或者其他的类型如用string表示的date类型,或者表示地理位置信息的对象。{
"n....
分类:
其他好文 时间:
2014-05-14 23:02:34
阅读次数:
390
【题目】
Determine whether an integer is a palindrome. Do this without extra space.
【题意】
题意判断一个整数是否是回文数
注意一下几点:
1. 不能用额外的空间
2. 负数不是回文数...
分类:
其他好文 时间:
2014-05-14 20:31:10
阅读次数:
298
1、
??
Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original str...
分类:
其他好文 时间:
2014-05-14 20:22:58
阅读次数:
275
Total Accepted: 8400 Total Submissions: 38235 My Submissions
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profi...
分类:
其他好文 时间:
2014-05-14 19:39:53
阅读次数:
275