Problem:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
set(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.

Problem:
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

Given a binary tree, flatten it to a linked list in-place.

For example,
Given

    1
/ \
2   5
/ \   \
3   4   6


The flattened tree should look like:

1
\
2
\
3
\
4
\
5
\
6


Problem:
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

For example:
Given the below binary tree and sum = 22,

      5
/ \
4   8
/   / \
11  13  4
/  \      \
7    2      1


return

[
[5,4,11,2],
[5,8,4,5]
]


Problem:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

For example:
Given the below binary tree and sum = 22,

      5
/ \
4   8
/   / \
11  13  4
/  \      \
7    2      1


return true, as there exist a root-to-leaf path 5->4->11->2 which sum is 22.

Problem:
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

Problem:
Reverse digits of an integer.

Example1: x = 123, return 321
Example2: x = -123, return -321

Problem:
Given an input string, reverse the string word by word.

For example,
Given s = “the sky is blue”,
return “blue is sky the”.

For C programmers: Try to solve it in-place in O(1) space.

thr runtime is 384ms

JUnit Test Code

leetcode地址：https://leetcode.com/problems/3sum/

Problem:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:

• Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c)
• The solution set must not contain duplicate triplets.
For example, given array S = {-1 0 1 2 -1 -4},

A solution set is:
(-1, 0, 1)
(-1, -1, 2)

## 解法2

按照一维数组中2求两个数字之和的思路：复杂度为O(N^2),runtime:322ms

## 参考

搜索引擎的使用对于我们来说不陌生，对于一个正常的搜索流程，比如用户输入查询“搜索引擎 技术”，搜索引擎需要分别将存储的磁盘上的两个单词的倒排序索引读入内存，之后进行解压缩，然后求两个单词对应倒排序列表的搅基，找到所有包含两个单词的文档集合，根据排序算法来对每个文档的相关性进行打分，按照相关度输入相关最高的搜索结果。

但是对于这系列步骤中海量文档数据的来源，存储，查找的技术又是如何的呢？下面是我最近看了《这就是搜索引擎：核心技术详解》这书的大致总结：

## 为什么要写自己的Ajax后台框架

现在Ajax在web应用方面已经用的稀巴烂了，如果你做一个网站没有用到ajax都不好意思拿出手，虽然面对ajax的潮流下，在.net开放方向，微软已经做了很多工作了，比如推出了ajax的服务器端控件，但是他不够灵活，用的人多吗？不多！

在.Net环境下与ajax配合的几种情况（主要是针对webform，因为.net mvc你只要写action就可以将方法给发布出来，实现ajax的调用）：