来自《The Elements of Java Style》-《Java编程风格》一书,值得一读的书籍,会让你在细节上节省很多时间,合作之间更加愉快!好处不多说了,但是有几个原则如下:1.保持原有风格2.坚持最小惊奇原则3.第一次就做对4.记录所有非规范行为格式规范:1.缩进嵌套的代码:在每个代码块...
分类:
编程语言 时间:
2014-11-30 16:46:01
阅读次数:
258
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.这题思路参照Conve...
分类:
其他好文 时间:
2014-11-29 20:07:35
阅读次数:
178
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat...
分类:
其他好文 时间:
2014-11-29 10:12:55
阅读次数:
167
Matrix
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 19113
Accepted: 7193
Description
Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] me...
分类:
编程语言 时间:
2014-11-28 10:25:34
阅读次数:
168
1.accumulate:Computes the sum of all the elements in a specified range including some initial value by computing successive partial sums or computes t...
分类:
编程语言 时间:
2014-11-28 09:50:38
阅读次数:
197
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 ...
分类:
其他好文 时间:
2014-11-28 06:18:21
阅读次数:
164
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.有序数组变二叉平衡搜索树,不难,递归就行。每次先序建立根节点(取最中间的数),然后用子区间划分左右子树。一...
分类:
其他好文 时间:
2014-11-27 23:20:29
阅读次数:
269
问题描述:
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [...
分类:
其他好文 时间:
2014-11-26 22:39:47
阅读次数:
201
BandwidthGiven a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and anorderingon the elements in V, then thebandwidthof a nodevi...
分类:
其他好文 时间:
2014-11-26 20:54:01
阅读次数:
111
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from ...
分类:
其他好文 时间:
2014-11-26 16:29:34
阅读次数:
164