No video

Path with Minimum Effort - Leetcode 1631 - Python

  Рет қаралды 14,217

NeetCodeIO

NeetCodeIO

Күн бұрын

Пікірлер: 33
@criconicsbyme6713
@criconicsbyme6713 11 ай бұрын
thanks neetcode, the question candy was asked in my interview...I saw ur video 😅 before the interview❤❤❤
@LOVE-kf9xi
@LOVE-kf9xi 11 ай бұрын
cleared the interview ? did you get the job?
@NeetCodeIO
@NeetCodeIO 11 ай бұрын
Damn thats good timing!!!
@neo3000
@neo3000 11 ай бұрын
Lol may be the interviewer is watching this channel like me.
@bundiderp5109
@bundiderp5109 11 ай бұрын
You explain the thought process so understandably and in great detail that I don't even feel dumb anymore.
@artinmayur
@artinmayur 11 ай бұрын
While writing the code and explaining to us, can you pretend that you don't know the exact next line and try then try to solve.... There should be more iteration or going back to previous lines to add something new that we just realised while writing the code, like that..😅
@kirillzlobin7135
@kirillzlobin7135 10 ай бұрын
How come you could solve it in such a brilliant way. My first idea was to somehow use DFS. I wanted to go trough all possible routes and calculate the diff for them. And than return the min value. I wanted to do it with O (N ^ Infinity) time complexity, but this...... This is sooooooooo amazing....
@damirsharip604
@damirsharip604 11 ай бұрын
thank you very much, this daily tasks are going harder and harder, needs new type of algorithms for me, union find, difikstra. I am glad to have you and you brilliant solutions with explanations. thank you
@YT.Nikolay
@YT.Nikolay 11 ай бұрын
I solved this question myself, but I overcomplicated it, I built an adj list and traversed nodes using dijkstra's algorithm, but anyway, I proud I solved it myself, and huge part of this is you neetcode, thanks!
@harmaina6060
@harmaina6060 11 ай бұрын
try to add these code and notes link in the discription please, would be very helpful
@prajjwaldubey5787
@prajjwaldubey5787 11 ай бұрын
understood in one go excellent explaination, could you please solve leetcode 827 making large islands
@Raymond-Wu
@Raymond-Wu 11 ай бұрын
instead of checking if the new row and new col is < 0 or == len(row)/len(row[0]) like you did in lines 20/21 you can just check if next_row in range(len(heights)) and next_col in range(len(heights[0])). Less text!
@user-yj2ju9up8o
@user-yj2ju9up8o 11 ай бұрын
it's less efficient
@Raymond-Wu
@Raymond-Wu 11 ай бұрын
@@user-yj2ju9up8o Is it? What's your thoughts behind that?
@dankiy3679
@dankiy3679 6 ай бұрын
Could you please help me understand why we should use Djikstra algorithm here? I understand that we can use it here but how much faster will it be compared to the regular DFS with memoization storing the cost to reach (row - 1, col - 1) element?
@royd-l
@royd-l 4 ай бұрын
I believe the big O is the same for Djikstra and DFS but Djikstra has a faster runtime complexity on average because its traversal is more directed than DFS, meaning it is technically more optimal
@faridahmed6252
@faridahmed6252 21 күн бұрын
I hope we all recognise that this is too genius of a solution
@gradientO
@gradientO 11 ай бұрын
so bfs with a priority Q instead of normal Q?
@kamilrudny1884
@kamilrudny1884 11 ай бұрын
More like dijkstra's algorithm rather than bfs
@alissabrave424
@alissabrave424 Ай бұрын
how this comes to find min path we are trying to find max in every time?
@schan263
@schan263 9 ай бұрын
Great video but I think the original and "corrected" time complexity is wrong. Can you explain how you came up with the "corrected" time complexity if you think it is correct?
@nosh3019
@nosh3019 4 ай бұрын
very. clear, thanks!
@StellasAdi18
@StellasAdi18 11 ай бұрын
Thanks for amazing explanation. Do we need to check visit condition on line 22 as it’s checked on line 12 when popping?
@truongquochung4858
@truongquochung4858 6 ай бұрын
It's not required, but doing so will avoid unnecessary heap push -> reduce the time complexity significantly
@pastori2672
@pastori2672 Ай бұрын
problem name so real
@SmoothCode
@SmoothCode 11 ай бұрын
Can you please explain why a simple DFS method (without binary search) would not work to solve this problem? To me - all it seems to care about is the minimum absolute difference to get from 0,0 to the bottom right corner cell. Would you say it is impossible to use a DFS method to solve this problem? If so - please elaborate on why.
@sk_4142
@sk_4142 11 ай бұрын
I came up with a DFS backtracking solution, but it lead to a TLE, which makes sense since the solution would end up being O (3^(m*n)) time (not O(4^(m*n)) since we can't revisit a cell by moving backwards in a direction) because it would end up considering all paths from heights[0][0] to heights[m-1[n-1], which is very slow compared to Dijkstra's, which is O(m * n log(m *n)) time
@rohanchess8332
@rohanchess8332 11 ай бұрын
This looks very similar to the Prims algo, is it the same or is it different?
@jesmigeorge4936
@jesmigeorge4936 11 ай бұрын
can you please explain the problem 403. Frog Jump . I'm stuck on it. I know how to start but somehow I get stuck and not able to reach the solution.
@johnsoto7112
@johnsoto7112 11 ай бұрын
is a heap required to solve this problem?
@tuandino6990
@tuandino6990 25 күн бұрын
You can do binary search combine with simple dfs/bfs
@devkumar9889
@devkumar9889 11 ай бұрын
Please make today's video , it's very tough to understand
@chitranshjawere4953
@chitranshjawere4953 2 ай бұрын
isn't this just A* ?
G-37. Path With Minimum Effort
24:30
take U forward
Рет қаралды 133 М.
АЗАРТНИК 4 |СЕЗОН 1 Серия
40:47
Inter Production
Рет қаралды 1,2 МЛН
Glow Stick Secret Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 18 МЛН
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 4,7 МЛН
Shortest Bridge - Leetcode 934 - Python
14:51
NeetCode
Рет қаралды 37 М.
Champagne Tower - Leetcode 799 - Python
13:48
NeetCodeIO
Рет қаралды 11 М.
Design LeetCode - System Design Interview
12:11
SystemDesignSchool
Рет қаралды 2,4 М.
why are switch statements so HECKIN fast?
11:03
Low Level Learning
Рет қаралды 407 М.
I Feel Bad For New Programmers
19:12
ThePrimeTime
Рет қаралды 438 М.
Shortest Path with Alternating Colors - Leetcode 1129 - Python
13:43
How I Approach a New Leetcode Problem (live problem solving)
25:31
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 647 М.
Path with Maximum Probability - Leetcode 1514 - Python
13:11
NeetCodeIO
Рет қаралды 13 М.
АЗАРТНИК 4 |СЕЗОН 1 Серия
40:47
Inter Production
Рет қаралды 1,2 МЛН