Problem Description
There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom
face, left ...
分类:
其他好文 时间:
2014-09-15 01:08:48
阅读次数:
204
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i...
分类:
编程语言 时间:
2014-09-14 23:17:17
阅读次数:
292
我写了两个版本供参考:
递归版本
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {
return addTwoNumbers(l1, l2, 0);
}
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2, int carry) {
...
分类:
其他好文 时间:
2014-09-14 12:53:17
阅读次数:
216
hdu 2817 A sequence of numbers...
分类:
其他好文 时间:
2014-09-14 09:00:06
阅读次数:
188
public class Solution { public boolean isPalindrome(int x) { if (x= 10 ) highNum *= 10; while (highNum > lowNum) { ...
分类:
其他好文 时间:
2014-09-13 20:01:25
阅读次数:
171
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-09-13 20:00:35
阅读次数:
207
题意:一个H-number是所有的模四余一的数,如 1,5,9,13,17,21...
H-primes数是H-number数(1除外),且它的H-number因子除了1只有它本身,如5,9,13,17,21...
但65是H-number数,却不是H-primes数,因为 65=5*13.
H-semi-prime是H-number数,且等于2个H-primes的乘积.如65
给你一个数n,问1到n有多少个H-semi-prime数
分析:用筛选法的思想,将H-primes筛选出来,同时标记在范围内两个H...
分类:
其他好文 时间:
2014-09-13 17:20:06
阅读次数:
247
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible...
分类:
其他好文 时间:
2014-09-13 09:26:54
阅读次数:
160
what are the rules for how == converts types?关于"=="的比较规则:1. Comparing numbers and strings will always convert the strings to numbers.number类型与string类型...
分类:
Web程序 时间:
2014-09-13 00:38:34
阅读次数:
369
leetcode 经典题 DP Palindrome Partitioning II...
分类:
其他好文 时间:
2014-09-11 23:56:32
阅读次数:
332