2290. Minimum Obstacle Removal to Reach Corner | !DP | Dijkstras | 0-1 BFS | Graphs

  Рет қаралды 524

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 7
@Unknown373d
@Unknown373d 7 сағат бұрын
great vid
@usirikayalaharish787
@usirikayalaharish787 8 сағат бұрын
class Solution: def minimumObstacles(self, grid: List[List[int]]) -> int: def f(i, j): if i == m - 1 and j == n - 1: return 0 if (i, j) in dp: return dp[(i, j)] mini = float('inf') vis.add((i, j)) for r, c in [[0,-1], [0,1],[1,0],[-1,0]]: nr, nc = r + i, c + j if 0
@KrishnaSharma-bv5ys
@KrishnaSharma-bv5ys 9 сағат бұрын
Still didn’t get, why dp won’t work here😢
@ARYANMITTAL
@ARYANMITTAL 9 сағат бұрын
okay, think other way around, tell me what approach you would have taken if you would have used dp?
@anuragsingh7100
@anuragsingh7100 8 сағат бұрын
@@ARYANMITTAL class Solution { int m,n; int solve(int i,int j,vector& grid,vector& ans){ if(i==m-1&&j==n-1) return grid[i][j]; if(ans[i][j]!=INT_MAX) return ans[i][j]; int d[]={-1,0,1,0,-1}; int a=INT_MAX; for(int k=0;k=0&&nr=0&&nc
@JIGARSINGTHAKOR-yy6qp
@JIGARSINGTHAKOR-yy6qp 7 сағат бұрын
In dp you can have subproblem to solve complete problem But here you cannot divide the problem into subproblem as all the 4 direction are possible.
@KrishnaSharma-bv5ys
@KrishnaSharma-bv5ys 4 сағат бұрын
@ By visiting all directions and take a visited matrix to track visited cells.
Programming Is Cooked
9:30
ThePrimeTime
Рет қаралды 280 М.
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Lazy days…
00:24
Anwar Jibawi
Рет қаралды 6 МЛН
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,6 МЛН
3366. Minimum Array Sum | Not Greedy | DP | Memoization
14:30
Aryan Mittal
Рет қаралды 659
Domain-Driven Design: The Last Explanation You'll Ever Need
21:05
Software Developer Diaries
Рет қаралды 11 М.
The hidden beauty of the A* algorithm
19:22
Polylog
Рет қаралды 900 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 151 М.
The Best Way to Learn Linux
9:45
Mental Outlaw
Рет қаралды 133 М.
Brutally Honest Advice for my younger C++ gamedev self
9:14
Low Level Game Dev
Рет қаралды 9 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 740 М.
Is She Dead? 💔🥺 #shorts #video #reaction #sad #cat
0:10
Potato Queen
Рет қаралды 18 МЛН
Beatbox magic challenge #tiktok #beatbox
0:40
Beatbox Mighty
Рет қаралды 8 МЛН
Грустная Концовка 😂
0:19
Глеб Рандалайнен
Рет қаралды 7 МЛН