A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message con...
分类:
其他好文 时间:
2014-10-12 16:45:38
阅读次数:
157
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-...
分类:
其他好文 时间:
2014-10-12 15:51:58
阅读次数:
190
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5062题目意思:给出 N,找出 1 ~ 10^N 中满足 Beautiful Palindrome Numbers (BPN)的数量有多少。 满足 BPN 的条件有两个:(1)回文串 (2)对称的部分从....
分类:
其他好文 时间:
2014-10-12 13:30:28
阅读次数:
185
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest...
分类:
其他好文 时间:
2014-10-11 14:52:35
阅读次数:
167
题目:codeforces 165E - Compatible Numbers
题意:给出n个数,然后每个数对应输出一个当前数组中与 Ai 与运算为 0 的数,没有的话输出-1
分析:简单的位运算题目,技巧性题目
首先,我们知道与运算的性质,就是只有同时为 1的时候才是1,那么假如 x&y=0 ,就是至少 x 的为1的为 y 全为0,其他为自由,假设为 1 ,那么 y = x...
分类:
其他好文 时间:
2014-10-11 10:50:15
阅读次数:
260
一篇文章:4 个用于执行高级数学计算的 JavaScript 库numbers.jsNumeric Javascriptaccounting.jsTangle有时只需要加减乘法能精确,没必要用到库。首先看下js浮点运算问题。JS里做小数的乘法运算时会出现浮点错误,具体可以测试一下: 结果是251.8...
分类:
编程语言 时间:
2014-10-10 19:52:24
阅读次数:
225
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-10-10 16:26:13
阅读次数:
141
1 from random import choice 2 3 cave_numbers = range(1,21) 4 wumpus_location = choice(cave_numbers) 5 player_location = choice(cave_numbers) 6 while.....
分类:
编程语言 时间:
2014-10-10 15:18:43
阅读次数:
289
Problem: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...
分类:
其他好文 时间:
2014-10-10 01:32:53
阅读次数:
213