Pacific Atlantic Water Flow - Leetcode 417 - Graphs (Python)

  Рет қаралды 6,999

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 22
@GregHogg
@GregHogg 6 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@saideep7510
@saideep7510 2 ай бұрын
I am currently doing NeetCode 150 and watch his videos regularly, but every once in a while when I feel like his solution is a little complex to understand I check if you have uploaded a video on the same question and if you have then I go through it cause coincidently most of the times your version of the solution is comparatively much easier to understand. Thanks!
@ShivamSharma-t8c
@ShivamSharma-t8c 24 күн бұрын
Real
@anuradhasuresh3451
@anuradhasuresh3451 2 ай бұрын
Hi Greg, graph problems scared me at first, but after watching your videos and how wonderfully you break everything down into simple code, I'm getting more confident with them! Thanks a lot.
@vivek2319
@vivek2319 3 ай бұрын
I compared this solution to other channels' solution and I feel yours is the most easiest to read and understand. Thanks 😇
@vikramkhurana1331
@vikramkhurana1331 4 ай бұрын
Broke down a complex problem beautifully
@auraSinhue
@auraSinhue 24 күн бұрын
Great explanation!
@Anantlahamge07
@Anantlahamge07 28 күн бұрын
bro ngl till now the hardest problem and solution. but it's only because of Greg that a rookie like me could comprehend how to solve this Q 😭😭
@vuanhkhoa9715
@vuanhkhoa9715 9 ай бұрын
Hi Greg ! Can I ask for your discord community server ? I saw it somewhere but now Im unable to find it
@GregHogg
@GregHogg 8 ай бұрын
Right here! discord.com/invite/g4ZnYzTB
@codinggigs8367
@codinggigs8367 4 ай бұрын
Here is my solution that I come up with after hearing your thought process. It might be simple to understand : from collections import deque class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: rows , cols = len(heights), len(heights[0]) visited_p = [[0 for _ in range(cols)] for _ in range(rows)] visited_a = [[0 for _ in range(cols)] for _ in range(rows)] row_col_list = [(1,0),(-1,0),(0,1),(0, -1)] set_p = set() set_a = set() que_p = deque() que_a = deque() for r in range(rows): for c in range(cols): if r == 0 or c == 0: set_p.add((r,c)) que_p.append((r, c, heights[r][c])) visited_p[r][c] = -1 if r == rows - 1 or c == cols -1: set_a.add((r,c)) que_a.append((r, c, heights[r][c])) visited_a[r][c] = -1 while que_p: rqp, cqp, htqp = que_p.popleft() for rl, cl in row_col_list: rn = rqp + rl cn = cqp + cl if 0
@bigk9000
@bigk9000 4 ай бұрын
I still struggle on how you were able to come up with the solutions to most of these! @_@
@hariharasudharsan3170
@hariharasudharsan3170 9 ай бұрын
Great work.... Can you make videos for DSA concepts too!
@GregHogg
@GregHogg 8 ай бұрын
Thanks! Yeah after this leetcode playlist is done I'll be doing a playlist on the generic theory
@hariharasudharsan3170
@hariharasudharsan3170 8 ай бұрын
@@GregHogg fast as you can....🤝🏻
@yygysgtyfugunvt
@yygysgtyfugunvt 6 ай бұрын
Your discord server link is invalid
@user-jm6gp2qc8x
@user-jm6gp2qc8x 5 ай бұрын
lol this seems to be the hardest solution in your series (and i have finished even the dp ones in yours)
@dishandshah660
@dishandshah660 7 ай бұрын
thanks
@_PulpoPaul
@_PulpoPaul 5 ай бұрын
This make me feel like a stupid
@GarouNguyen
@GarouNguyen 6 ай бұрын
Bro what is r, c = i+i_o, j+j_o, can you explain bro i don't understand 😢
@vikramkhurana1331
@vikramkhurana1331 4 ай бұрын
i_o and j_o are offsets.. so for [0,1], r ,c = i+0,j+1, so j is incremented, so it is square right to i,j. We go through the list of all 4 neighboring squares to check if water can flow from them to us
Clone Graph - Leetcode 133 - Graphs (Python)
13:38
Greg Hogg
Рет қаралды 6 М.
Pacific Atlantic Water Flow - Leetcode 417 - Python
16:28
NeetCode
Рет қаралды 204 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Koko Eating Bananas - Leetcode 875 - Binary Search (Python)
13:34
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 835 М.
The LeetCode Fallacy
6:08
NeetCode
Рет қаралды 608 М.
The Sad Reality of Being a Data Scientist
8:55
Samson Afolabi
Рет қаралды 118 М.
Coin Change - Leetcode 322 - Dynamic Programming (Python)
15:27
Pacific Atlantic Water Flow | Live Coding with Explanation | Leetcode - 417
13:32
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 363 М.
Number of Islands - Leetcode 200 - Graphs (Python)
11:01
Greg Hogg
Рет қаралды 15 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 296 М.