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-07-13 18:20:52
阅读次数:
202
Matrix Chain Multiplication
Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which multi...
分类:
其他好文 时间:
2014-07-13 18:10:40
阅读次数:
223
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-07-13 16:37:16
阅读次数:
199
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are
all va...
分类:
其他好文 时间:
2014-07-13 16:11:26
阅读次数:
144
也是多重背包可行性问题。时间复杂度为 O(VN); V=背包容量,N=物品数量。
题意是说给你N个物品,每个物品有不同的价值与数量。分给两个院。
问你怎么分配才让能让价值尽量相等。
跟我上一篇解题报告是一种类型。以价值为费用,总价值的一半为背包容量。
不过物品有点多,直接开数组可能会超内存。我就用了滚动数组。
需要注意的是 you should guarant...
分类:
其他好文 时间:
2014-07-13 15:45:40
阅读次数:
208
获取某个栏目下的列表: {pc:content action="lists" catid="15" num="10" order="id DESC" return="info"} {loop $info $v} {$v['title']}{date('m-d',$v['inputt...
分类:
Web程序 时间:
2014-07-13 10:45:13
阅读次数:
253
方法一:
/** List order not maintained **/
public static void removeDuplicate(ArrayList arlList)
{
HashSet h = new HashSet(arlList);
arlList.clear();
arlList.addAll(h);
}
方法二:
/** Lis...
分类:
其他好文 时间:
2014-07-12 22:45:06
阅读次数:
241
黑客和敏捷开发
前段时间读了一下Paul Graham的《黑客与画家》(Hackers and Painters: Big Ideas from the Computer Age),虽说这书已经出版良久了,但是读书往往是不讲究时间的,有收获就好。这本书是文集,相对内容比较散,针对的也并非是业内人士,所以不同人在不同角度可以把这本书看出千滋百味。但不管怎么说,我觉得绝大多数人,都可以从这本书中收获...
分类:
其他好文 时间:
2014-07-12 21:26:07
阅读次数:
233
简单小结下CXF跟REST搭配webservice的做法,直接举代码为例子:
1 order.java
package com.example.rest;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Order")
public class Order {
...
分类:
Web程序 时间:
2014-07-12 19:51:13
阅读次数:
279
SELECT 和ORDER BY结合进行排序:
products表如下:
a 按产品名称列进行排序:
b 按多个列进行排序,默认排序顺序为升序:
c 指定排序方向,即指定为降序:
d 对多个列进行排序,先按产品价格降序排列,再按产品名称排列
e 找出某一列最高值或者最低值...
分类:
数据库 时间:
2014-07-12 17:58:18
阅读次数:
288