摘要:
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... 阅读全文
摘要:
对于此类问题:对于元素nums[i],找出往左/右走第一个比它小/大的数字我们常常用递增栈/递减栈实现。递增栈实现第一个比它小递减栈实现第一个比它大Example: 2 1 5 6 2 3stack: 保证栈是递增的顺序,因此每个数进来之前先删除栈里比它大的数字。 因此每个数,当它被... 阅读全文
摘要:
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... 阅读全文
摘要:
OutlineLinear Data StructureQueueStackHashTree Data StructureHeapDefinitionData Structure is a way to organize data. It provides some methods to handl... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文