So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letter...
分类:
其他好文 时间:
2014-07-22 23:03:53
阅读次数:
521
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 digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-01 22:08:19
阅读次数:
366
Given two binary trees, write a function to
check if they are equal or not.Two binary trees are considered equal if they are
structurally identical an...
分类:
其他好文 时间:
2014-05-01 16:06:46
阅读次数:
427
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-05-01 08:35:40
阅读次数:
443
给两个长度分别为n和m的序列,现在有两种操作:1.分别选择两个序列的一个非空前缀,切两个前缀的最后一位相同,删除之,得到1分(只累计),消耗e;2.直接删除两个序列,消耗值定于两个序列之前删除的元素个数之和,并且使得得到的分有效(之前没有有效分)
(1?≤?n,?m?≤?105; 1?≤?s?≤?3·105; 103?≤?e?≤?104),s代表总能量,e表示一次操作的消耗...
分类:
其他好文 时间:
2014-04-30 22:13:40
阅读次数:
261
1D people lived in a 1D country. Everything in the country was one-dimensional, and everything was simple and clear: just one axis and two directions — forward and backward. Even a 1D world has proble...
分类:
其他好文 时间:
2014-04-29 13:44:22
阅读次数:
284
Pat1063代码
题目描述:
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets,
and Nt is the to...
分类:
其他好文 时间:
2014-04-29 13:44:20
阅读次数:
325
Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two endpoints of line i is at (i, ai) and (i,
0). Fin...
分类:
其他好文 时间:
2014-04-29 13:15:21
阅读次数:
415
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
思路同十进制的大数相加。代码如下:
class Solution {
public:
string addBinary(string a, str...
分类:
其他好文 时间:
2014-04-29 13:12:20
阅读次数:
328
RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow:
> choose two large prime integer p, q
> calculate n = p × q, calculate F(n) = (p - 1) × (q - 1)
...
分类:
其他好文 时间:
2014-04-27 21:37:59
阅读次数:
315