摘要: Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2014-01-28 23:38 Averill Zheng 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofeverynode never differ by more than 1. 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 ... 阅读全文
posted @ 2014-01-28 22:35 Averill Zheng 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors 1 /** 2 * Definition for undirected graph. 3 * class Und... 阅读全文
posted @ 2014-01-28 10:52 Averill Zheng 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 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 ... 阅读全文
posted @ 2014-01-28 10:48 Averill Zheng 阅读(136) 评论(0) 推荐(0) 编辑