数据结构与算法
Ruidu_Doer
C++/计算广告/数据挖掘/搜索引擎
展开
-
42. Trapping Rain Water
Given n non-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.For example,Given [0,1,0,2,1,0,1,3,2,1,2,1], ret...原创 2019-03-17 00:31:07 · 168 阅读 · 0 评论 -
84. Largest Rectangle in Histogram
Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each b...原创 2019-03-17 00:32:50 · 180 阅读 · 0 评论 -
239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window m...原创 2019-03-17 00:34:04 · 218 阅读 · 0 评论 -
栈的问题
对于栈一类的问题,个人感觉可能会很“复杂”,但是不会是特别“难于理解”,解题的时候一定要把过程想得很清楚。leetcode值得刷的题1. 复杂过程仔细分析的42. Trapping Rain Water84. Largest Rectangle in Histogram超级相似的两道题,不过水这个因为有连续性可以用双指针,最大直方图还是要老老实实用栈来做,其核心思路是如...原创 2019-03-17 00:37:46 · 403 阅读 · 0 评论 -
239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window m...原创 2019-03-17 00:36:30 · 187 阅读 · 0 评论 -
155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the ...原创 2019-03-17 00:35:54 · 179 阅读 · 0 评论 -
316. Remove Duplicate Letters
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order a...原创 2019-03-17 00:35:15 · 218 阅读 · 0 评论