Problem 2: Even Fibonacci numbers
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2,...
分类:
其他好文 时间:
2014-05-22 23:29:44
阅读次数:
435
Problem 4: Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest pal...
分类:
其他好文 时间:
2014-05-22 18:48:46
阅读次数:
355
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-22 16:46:03
阅读次数:
173
When you subtract two variables of type TIMESTAMP, you get an INTERVAL DAY TO SECOND which includes a number of milliseconds and/or microseconds depending on the platform. If the database is running o...
分类:
其他好文 时间:
2014-05-21 15:36:38
阅读次数:
488
【题目】
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n, generate...
分类:
其他好文 时间:
2014-05-21 15:20:07
阅读次数:
213
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【题意】
给定用字符串表示的整数,返回两个数的乘积结果字符串。两个数字都非负,且能任意大。
【思路】
1. 考虑其中一个数是0的情况
2. 模拟乘法运算...
分类:
其他好文 时间:
2014-05-21 13:45:37
阅读次数:
214
1、
??
Add Two Numbers
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 num...
分类:
其他好文 时间:
2014-05-21 10:49:10
阅读次数:
221
There are two types of non-blocking thread synchronization algorithms
- lock-free, and wait-free. Their meaning is often confused. In lock-free systems, while any particular computation may be block...
分类:
其他好文 时间:
2014-05-21 10:27:20
阅读次数:
410
题目:不用乘、除、取模运算来实现除法。
减法可以实现除法在是我们早就知道的,但是可能会出现问题,比如极端情况,a = 0x7FFFFFFF,b = 1,求a/b,这要减法运算多少次?
回想下我们开始学习计算机的时候,涉及到的进制之间的转换,就是给定你一个十进制数,写出他的二进制,刚开始的时候很傻,就按着书上的方法去不停的除以2,除以2,除以2,。。。可笑的是居然天真的算过1024的二进制,更可...
分类:
其他好文 时间:
2014-05-21 08:32:30
阅读次数:
191
题目:
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 numbers such that they add up t...
分类:
其他好文 时间:
2014-05-21 07:42:18
阅读次数:
230