题目链接Given a string, find the length of the
longest substring without repeating characters. For example, the longest
substring without repeating letter...
分类:
其他好文 时间:
2014-05-24 02:15:57
阅读次数:
291
题目:Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space ...
分类:
其他好文 时间:
2014-05-23 11:31:51
阅读次数:
299
Determine whether an integer is a palindrome.
Do this without extra space.if use recursive, like check the first dig and last
dig, then remove them, c...
分类:
其他好文 时间:
2014-05-23 02:45:15
阅读次数:
230
Smallest multiple
Problem 5
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly di...
分类:
其他好文 时间:
2014-05-23 01:51:13
阅读次数:
261
一道笔试题,纸上写的,誊到电脑上并调试通过。没经验,摸索的野蛮做法,不知道有没有更简洁更抽象的算法。
是英文题,原题是不用buffer(缓存)反转字符串打印输出,受OJ的毒害,我就认为只要逆序打印就行了(要是把原字符串改了,我还真不知道怎么办到,尤其听说字符串常量不能被更改,在文章尾部会做验证)。
版本一:
用了一下递归,思路是用指针遍历字母,每碰到空格就用新指针往下递归调用...
分类:
其他好文 时间:
2014-05-22 10:12:28
阅读次数:
298
问题
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorde...
分类:
其他好文 时间:
2014-05-22 07:04:46
阅读次数:
298
Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space is ...
分类:
其他好文 时间:
2014-05-21 19:11:16
阅读次数:
266
【题目】
Divide two integers without using multiplication, division and mod operator.
【题意】
计算两个数的商,不能使用乘、除、取余操作
【思路】
用加法,确定多少除数相加其和恰好<=被除数
为了提高算法效率,利用贪心思想,采用滚雪球式的翻倍叠加策略,使和快速逼近被除数
集中特殊情况需要注意:
1. 结果是负数
...
分类:
其他好文 时间:
2014-05-18 10:42:00
阅读次数:
259
【题目】
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters.
For example, given:
S:...
分类:
其他好文 时间:
2014-05-18 08:31:48
阅读次数:
228
>>>>1. 概述>>> 2. 一个简单的例子 Client
Without Log4j * Description: a sample with log4j * @version 1.0 */ public class
ClientWithoutLog4j { /**...
分类:
其他好文 时间:
2014-05-17 21:54:39
阅读次数:
545