Container With Most Water - Leetcode 11 - 2 Pointers (Python)

  Рет қаралды 7,428

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 15
@GregHogg
@GregHogg 5 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@JoeTan-nq4fq
@JoeTan-nq4fq 2 ай бұрын
Being OCD, to reduce the computational time, we can do the height check and compute the area in the same conditional (instead of adding min(height[l], height[r] which add n runtime). if height[left] < height[right]: area = height[left] * (right - left) left += 1 else: area = height[right] * (right - left) right -= 1 maxx = max(maxx, area)
@anna-plink
@anna-plink 4 ай бұрын
No way this was more difficult than 3Sum 🤔
@user-jm6gp2qc8x
@user-jm6gp2qc8x 3 ай бұрын
he sets you up for a harder problem just right after this one, its a trap XD
@rodneyshen7397
@rodneyshen7397 3 ай бұрын
I was legit thinking the exact same thing haha.
@ruixue6955
@ruixue6955 2 ай бұрын
1:39 2:22 how to move cursor 2:46 which bar to keep
@sreekanthpogula2714
@sreekanthpogula2714 10 ай бұрын
Great greg 👍, I just solved this yesterday
@GregHogg
@GregHogg 10 ай бұрын
That's great!
@coopernik
@coopernik 10 ай бұрын
very well explained
@dibyendusaha1295
@dibyendusaha1295 2 ай бұрын
golang solution: import ( "math" ) func maxArea(height []int) int { left := 0 right := len(height)-1 maxArea:=0 for left
@pauldaly1yt
@pauldaly1yt 10 ай бұрын
How long would one typically get to prepare a solution to a problem like this in an interview?
@brianwkinyua
@brianwkinyua 3 ай бұрын
I hear around 45 minutes.
@rijulranjan8514
@rijulranjan8514 2 ай бұрын
Nowadays not 45 mins. This is on the easier side interviewers would probably expect like 15-20 mins
@christianjt7018
@christianjt7018 5 ай бұрын
Awesome
@thequang9234
@thequang9234 7 ай бұрын
nice
Trapping Rain Water - Leetcode 42 - 2 Pointers (Python)
9:51
Greg Hogg
Рет қаралды 12 М.
Container with Most Water - Leetcode 11 - Python
12:37
NeetCode
Рет қаралды 375 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
3Sum Closest - Leetcode 16 - Two Pointers (Python)
8:54
Greg Hogg
Рет қаралды 4,5 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,1 МЛН
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 169 М.
I Scraped the Entire Steam Catalog, Here’s the Data
11:29
Newbie Indie Game Dev
Рет қаралды 671 М.
Learn Machine Learning Like a GENIUS and Not Waste Time
15:03
Infinite Codes
Рет қаралды 302 М.
Coin Change - Leetcode 322 - Dynamic Programming (Python)
15:27
I Redesigned the ENTIRE YouTube UI from Scratch
19:10
Juxtopposed
Рет қаралды 859 М.
What REALLY is Data Science? Told by a Data Scientist
10:33
Joma Tech
Рет қаралды 3,9 МЛН
R vs Python
7:07
IBM Technology
Рет қаралды 343 М.