上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页
摘要: Use one queue + size variable 1 public class Solution { 2 public ArrayList> levelOrder(TreeNode root) { 3 ArrayList result = new ArrayList... 阅读全文
posted @ 2015-10-26 00:37 树獭君 阅读(145) 评论(0) 推荐(0) 编辑
摘要: QuestionGivennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in th... 阅读全文
posted @ 2015-10-25 03:59 树獭君 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 对于此类问题:对于元素nums[i],找出往左/右走第一个比它小/大的数字我们常常用递增栈/递减栈实现。递增栈实现第一个比它小递减栈实现第一个比它大Example: 2 1 5 6 2 3stack: 保证栈是递增的顺序,因此每个数进来之前先删除栈里比它大的数字。 因此每个数,当它被... 阅读全文
posted @ 2015-10-25 03:26 树獭君 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Linear data structure.First In Last Out.push: O(1) pop: O(1) peek: O(1)In Java, there is aStackclass.A more complete and consistent set of LIFO stac... 阅读全文
posted @ 2015-10-25 02:41 树獭君 阅读(113) 评论(0) 推荐(0) 编辑
摘要: OutlineLinear Data StructureQueueStackHashTree Data StructureHeapDefinitionData Structure is a way to organize data. It provides some methods to handl... 阅读全文
posted @ 2015-10-25 02:19 树獭君 阅读(236) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven an array of non-negative integers. Find the largest multiple of 3 that can be formed from array elements.For example, if the input array... 阅读全文
posted @ 2015-10-25 01:44 树獭君 阅读(531) 评论(0) 推荐(0) 编辑
摘要: QuestionAcomplete binary treeis a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as p... 阅读全文
posted @ 2015-10-25 00:22 树獭君 阅读(212) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven an array of n integer with duplicate number, and a moving window(size k), move the window at each iteration from the start of the array,... 阅读全文
posted @ 2015-10-24 23:35 树獭君 阅读(169) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven an unsorted arraynums, reorder itin-placesuch thatnums[0] = nums[2] = nums[2] nums[i - 1])11 swap(nums, i, i - 1);1... 阅读全文
posted @ 2015-10-23 12:35 树獭君 阅读(241) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6... 阅读全文
posted @ 2015-10-22 08:26 树獭君 阅读(155) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页