this is the explanation I was looking for !!. thanks, Beauty with brain!!.
@adil_k11 ай бұрын
Hey Alisha... great explanation. Thanks for the video. I appreciate your effort.
@ashok20894 ай бұрын
Amazing walkthrough on DFS through matrix! Thanks!
@pankajkumarray67163 жыл бұрын
You have put lot of efforts, thanks for explaining. Helpful.
@ahmedanwer6899 Жыл бұрын
thanks for going deep with the depth first search traversal
@sarankumaar60092 жыл бұрын
your videos are gem no matter wat other video give.
@gitanjalikumari92622 жыл бұрын
This is one of the best explanation for this problem.. thank you😊
@yynnooot2 жыл бұрын
Thank you for the step-by-step explanation!
@gurgaon_videos3 ай бұрын
One correction - In line 22 you should change row( 2nd paramater) to matrix.size() -1 and column(third parameter) of fnc to i since we are traversing on the last row of grid.
@redlatming21363 жыл бұрын
This explanation was amazing! Been searching for a long time. Thanks!
@tarunmali62282 жыл бұрын
Hi Ma'am, you definitely make the best leetcode solutions!!! Your channel deserves more subscribers!! Your channel will boom one day similar to Nick White
@smartswaggy61142 жыл бұрын
Fantastic video Alisha mam. I love the way you explain and handle the unprecedented situation like laptop hanging. This qn is quite easy to do but explaining it to others is a difficult task. You nailed it in explanation. I have become your fan :)
@probabilitycodingisfunis12 жыл бұрын
Thanks @smartswaggy ...this means a lot!
@shivamkeshri5 ай бұрын
Can you discuss about the complexity as well??
@maddycoder12942 жыл бұрын
nice explaination di
@utkarshkanungo50922 жыл бұрын
wow thanks.... 32:34 struggle is real
@Daksh-dz7hk4 ай бұрын
Best video 💪
@pankajgoel36892 жыл бұрын
amazing step by step explaination
@adhed_engineer2 жыл бұрын
great stuff
@II-ii2um3 жыл бұрын
Welcome back :)
@reshmaparveen66793 жыл бұрын
Great explanation ❤️
@sundeepkumar38712 жыл бұрын
great explanation
@shubhamkale50032 жыл бұрын
Vary well explained
@gauravsharma12512 жыл бұрын
great
@lalitagarwal9155 Жыл бұрын
// SIMPLE C++ USING BFS 99.64% faster class Solution { public: int rows,columns; vectormovements{{1,0},{-1,0},{0,1},{0,-1}}; bool isValid(int r,int c){ return r>=0 and r=0 and c=heights[r][c] and sea[nr][nc]!=1){ q.push({nr,nc}); } } } } vector pacificAtlantic(vector& heights) { rows=heights.size(),columns=heights[0].size(); queueq1,q2; vectorres,pacific(rows,vector(columns,0)),atlantic(rows,vector(columns,0)); for(int i=0;i
@codeculture23 жыл бұрын
great explanation! thanks a lot.
@sahiltest73092 жыл бұрын
i just don t know how you guys think these things
@onkar11082 жыл бұрын
Great explanation !! Watching your explanations, the way you approach the problem matches with my thinking, so I love to watch your explanations. I can relate to the approach unlike other explanations on YT. Kudos to you. Definitely your channel is under valued but surely its gonna boom in the near future.
@probabilitycodingisfunis12 жыл бұрын
Thank you so much Onkar!
@SlokAks2 жыл бұрын
Same questions mentioning RED and BLUE lakes in interviewbit... BFS solution to above approach.. #define RED 1 #define BLUE 0 vector dx = {1, -1, 0, 0}; vector dy = {0, 0, 1, -1}; int m, n; vector visA, visB; bool isValid(int i, int j) { return i >= 0 && j >= 0 && i < m && j < n; } void bfs(vector &A, int i, int j, bool lake) { vector &vis = (lake == BLUE ? visA : visB); queue q; q.push({i, j}); int x, y; while(!q.empty()) { tie(i, j) = q.front(); q.pop(); if(vis[i][j]) continue; vis[i][j] = 1; for(int k = 0; k < 4; k++) { x = i + dx[k]; y = j + dy[k]; if(isValid(x, y) && A[x][y] >= A[i][j]) { q.push({x, y}); } } } } int Solution::solve(vector &A) { m = A.size(), n = A[0].size(); int ans = 0; visA = visB = vector (m, vector (n, 0)); for(int j = 0; j < n; j++) { bfs(A, 0, j, BLUE); bfs(A, m-1, j, RED); } for(int i = 0; i < m; i++) { bfs(A, i, 0, BLUE); bfs(A, i, n-1, RED); } for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { if(visA[i][j] && visB[i][j]) { ans++; } } } return ans; }
@abhishek042042 жыл бұрын
good explanation, how did you comeup with that idea,how can we develop to think that way. Thank you!
@probabilitycodingisfunis12 жыл бұрын
Keep practicing more variety of problems and that will help to develop thinking
@shvmsh202 жыл бұрын
crystal clear
@tejasjadhav80182 жыл бұрын
@vinaygoswami53742 жыл бұрын
This question took 2 hrs, but i was not able to solve it using brute force
@loveleshbhagat11142 жыл бұрын
class Solution { public: int dx[4] = {0,1,0,-1}; int dy[4] = {1,0,-1,0}; void dfs(int i,int j,int z,vector& heights,vector&reach){ reach[i][j][z]=1; for(int k=0;k=0 && ni=0 && nj