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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
フロントエンドのテストカバレッジは 100%強制がいい
bengo4com
7
3.7k
Welcome JXL!
dynamis
0
910
リリースしたで終わらない。 観測できるフロントエンド開発
yamakenji24
4
1.4k
Platform Engineering をベースとした Agentic Software Factory の実践
110y
3
1k
Terraform 0 to 100:100個以上のリポジトリを常に最新にし続けるための自動化
sue445
3
1.5k
正しくWeb サイトを守るためのコンテンツセキュリティーポリシー
hinalin
0
550
本の挿絵に困ったから挿絵メーカーを自作した
yoshimura_datam
1
120
成長するID管理基盤における運用もコストも犠牲にしないオブザーバビリティ向上の実践 / Improving Observability for a Growing Identity Platform Without Adding Operational Burden or Cost
kaminashi
1
140
ブース設計、 お前もプロダクトだったのか / So Booth Design Was a Product All Along
akihiro0038
0
190
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
5
18k
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
4
2.2k
目を覚ませ!僕らの認証情報が何者かに侵略されてるぞ
tkito
2
490
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
4
1.3k
Thoughts on Productivity
jonyablonski
76
5.5k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.7k
How to Talk to Developers About Accessibility
jct
2
630
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Designing for Timeless Needs
cassininazir
1
570
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
970
Bash Introduction
62gerente
615
220k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
850
How to train your dragon (web standard)
notwaldorf
96
6.9k