Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Largest Rectangle in Histogram
Search
Lu Dang
September 25, 2016
Technology
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Largest Rectangle in Histogram
http://www.lintcode.com/en/problem/largest-rectangle-in-histogram/
Lu Dang
September 25, 2016
Transcript
16 slides
2 1 5 6 2 3 0 positions heights 0
2 maxVal = 0 i == 0
2 1 5 6 2 3 0 positions heights 0
2 maxVal = 0 i == 1
2 1 5 6 2 3 0 positions heights i
== 1 maxVal = max(0, (i - 0) * 2) = 2 2
2 1 5 6 2 3 0 positions heights 0
1 i == 1 maxVal = max(0, (i - 0) * 2) = 2
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 2 i == 2 2 5
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 2 i == 3 2 5 3 6
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 2 i == 4 2 5 3 6
2 1 5 6 2 3 0 positions heights 0
1 maxVal = max(2, (i - 3) * 6) = 6 i == 4 2 5 6
2 1 5 6 2 3 0 positions heights 0
1 maxVal = max(6, (i - 2) * 5) = 10 i == 4 10
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 10 i == 4 2 2
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 10 i == 5 2 2 5 3
2 1 5 6 2 3 0 positions heights 0
1 maxVal = 10 i == 6 2 2 5 3
2 1 5 6 2 3 0 positions heights 0
1 maxVal = max(10, (i - 5) * 3) = 10 i == 6 2 2 3
2 1 5 6 2 3 0 positions heights 0
1 maxVal = max(10, (i - 2) * 2) = 10 i == 6 8
2 1 5 6 2 3 0 positions heights maxVal
= max(10, (i - 0) * 1) = 10 i == 6 6
“maxVal is 10.” 2 1 5 6 2 3 0
10
Other Decks in Technology
See All in Technology
Quick Automate | 目指せ Quick マスター 12
inariku
PRO
1
110
自治体AIコンタクトセンター、何をどこに任せる?~Amazon Connect Customer +Amazon Bedrockの実践知~ / 20261107 Satoshi Torano
shift_evolve
PRO
1
140
少ない人手 限られた予算 それでも守る 消せない・見つける・戻れる オールハザード型BCP on AWS / 20261107 Mitsutoshi Matsuo
shift_evolve
PRO
0
390
市販IoT機器や自作IoT機器とHomeAssistantを駆使して家の電気代をできる限り見える化する方法の考案
harutiro
0
200
Claude Codeで新規事業を伸ばせるか? Zennの試行錯誤の記録
wadayusuke
2
190
Kiro を使うコツ (頼み方、覚えさせ方、任せ方) | 目指せ Kiro マスター 09
inariku
PRO
3
170
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
140
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
220
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
270
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
6
4.9k
Agent Harnessはどう作る?事例から学ぶAI Agentの設計思想
sergicalsix
0
320
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
4
1.2k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
We Have a Design System, Now What?
morganepeng
55
8.4k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Raft: Consensus for Rubyists
vanstee
143
7.9k
Code Review Best Practice
trishagee
74
20k
RailsConf 2023
tenderlove
30
1.6k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
660
The Art of Programming - Codeland 2020
erikaheidi
57
14k
HDC tutorial
michielstock
2
1k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
480