Blocks就是存放一些可以被执行的代码的块,通常用do...end 或者 {}表示例如:[1, 2, 3].each do |num| puts numend[1, 2, 3].each { |num| puts num }
分类:
其他好文 时间:
2014-10-02 14:35:32
阅读次数:
151
Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l...
分类:
其他好文 时间:
2014-10-02 03:56:22
阅读次数:
198
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 ...
分类:
其他好文 时间:
2014-10-02 02:34:02
阅读次数:
227
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. ...
分类:
其他好文 时间:
2014-10-01 19:16:51
阅读次数:
223
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4],
[...
分类:
其他好文 时间:
2014-10-01 19:09:51
阅读次数:
144
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:
其他好文 时间:
2014-10-01 19:08:51
阅读次数:
163
Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express...
分类:
其他好文 时间:
2014-10-01 13:35:41
阅读次数:
233
N-Queens
Total Accepted: 15603 Total
Submissions: 60198My Submissions
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other...
分类:
其他好文 时间:
2014-10-01 12:42:01
阅读次数:
139
[leetcode]Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors....
分类:
其他好文 时间:
2014-09-30 14:21:59
阅读次数:
142
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-09-30 04:40:32
阅读次数:
182