Let's continue the habit of commenting “understood” if you got the entire video. Please give it a like too, you don't 😞 Do follow me on Instagram: striver_79
I like and comment on every video after doing the problem, it has become a muscle memory, as the explanation is best, Completed DP series now revising graph through the playlist
Your surrounded regions intuition was mindblowing, certainly grown interest in BFS and DFS on grids. Thank you striver. Could able to solve the problem on my own
Finally Solved Myself the whole question without looking into the solution even for a second. Thank you so much Striver bhaiya for brainstorming and taking me to the next level. Literally u take me forward!! 🔥🔥🔥🔥🔥
AT first i though it can be complex but after reading so many positive comment i gave try ,and in just one time it got solved .. ITNIIIIIII KHUSHIIIIIIII😭😭😭😭😭😭
Your Surrounded Regions approach helped a lot with this code, was able to solve this on my own. Thank you for the entire graph playlist, really appreciate what you are doing for the CS community!
We can use the concept of Surrounded regions to solve this problem. The concept of BFS is also amazing. Thanks Striver. Solved it on my own using DFS :)
@@aniketrai9643 Hi Aniket. Here is the code: I coded it on LeetCode: class Solution { private: void dfs(vector& mat,vector& visited,int row,int col,int delRow[],int delCol[]) { visited[row][col]=1; for(int i=0;i=0 && nrow=0 && ncol
This is undoubtedly the best content out there on the internet to learn graph problem. I was able to solve this problem without looking at the solution. I was intimidated by graph problem but now it's safe to say that I am really enjoying them. I am super grateful for your work Raj. Thank you so much!
Thank you so much Striver bhaiya. Earlier I was so scared of graphs but now I am able to solve questions on my own thank you so much. I am so grateful to you for this valuable content 🤗
Thanks so much. I'm following your graph series and this was one of the tough topics for me. I was able to solve this problem without watching this video. All other videos are also great for understanding. I never thought i would be able to solve any graph problem on my own. !!! thanks again.
I doesn't even know detail or an intermediate about dfs and bfs but the explanation that you had made was pretty much cool. Thank you sir for providing such content.
was too afraid of graph earlier. but as soon as started this series, intutions got stronger. Now as the lectures are increasing, i'm more able to solve questions.
ONE CHANGE (REQUIRED),I think we can check whether it is visited or not after popping from queue also , in this we need not required to start from boundary all the time
I really got to know the meaning of "if it works don't touch it" quote, here it is applicable at 14:32 , you can see that in line 53. instead of && , & worked because they were both true (1) and 1 &1 =1 =true .
Understood bro. Why we did not traverse on perimeter and sunk all the lands by marking them 0 connecting to perimeter with DFS? in the end, we check how many 1s are there in the grid and return the ans. It will save space too. What was the risk?
We usually don’t tamper with the data, we just return the final form of transformation which is needed. Imagine in a real life scenario, you are asked to modify some data, and in order to modify those specific points, you use a logic which harms others, it fixes it afyerwards, but it does harm it for some time, so we don’t do it 😄
As he has said many times before, you shouldn't be altering the data given as that's how things work in real life as well. Therefore, used the vis array for checking. Your approach is right and would give you the result as well.
you know guys i tried this question by using dfs so that i take a visited 2d matrix but if i take a visited 2d matrix i get time limited exceed but when i manipulate the same grid data my code submit successfully by the way great explanation i mention both the code here void dfs(int row,int col,vector&grid,int n,int m) { grid[row][col]=0; int drow[]={-1,1,0,0}; int dcol[]={0,0,-1,1}; for(int i=0;i=0 && r=0 && c
I dont know why but instead of using the nested loops when i use 2 seperate loops similar to the previous video it gives wrong answer for this ip 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 expected output is 3 but it gives 0 when i use individual loops for bfs call.
Let's continue the habit of commenting “understood” if you got the entire video. Please give it a like too, you don't 😞
Do follow me on Instagram: striver_79
love u bhaiya I am able to solve it myself
I like and comment on every video after doing the problem, it has become a muscle memory, as the explanation is best, Completed DP series now revising graph through the playlist
I solved this problem even without watching the lecture I am able to get the intuition thanks striver
Same here
✌✌
it is same as previous
@@varunaggarwal7126 yep
This is almost same as the previous problem , so no surprises there.
Same here bro!!!
Your surrounded regions intuition was mindblowing, certainly grown interest in BFS and DFS on grids. Thank you striver. Could able to solve the problem on my own
Yes, I've also greater interest in BFS and DFS on grids than before.
Finally Solved Myself the whole question without looking into the solution even for a second. Thank you so much Striver bhaiya for brainstorming and taking me to the next level.
Literally u take me forward!! 🔥🔥🔥🔥🔥
AT first i though it can be complex but after reading so many positive comment i gave try ,and in just one time it got solved ..
ITNIIIIIII KHUSHIIIIIIII😭😭😭😭😭😭
after reading ur comment i tried on my own aur hogya wow thnkeww anyways for commenting
Your Surrounded Regions approach helped a lot with this code, was able to solve this on my own. Thank you for the entire graph playlist, really appreciate what you are doing for the CS community!
We can use the concept of Surrounded regions to solve this problem. The concept of BFS is also amazing. Thanks Striver. Solved it on my own using DFS :)
bro even i tried dfs but im getting Runtime error can u share ur code
@@aniketrai9643 Hi Aniket. Here is the code:
I coded it on LeetCode:
class Solution {
private:
void dfs(vector& mat,vector& visited,int row,int col,int delRow[],int delCol[])
{
visited[row][col]=1;
for(int i=0;i=0 && nrow=0 && ncol
@@aniketrai9643
void dfs(auto & grid , auto & visited, int n,int m , int r , int c){
visited[r][c] = true;
pair arr[] = {{-1,0},{1,0},{0,-1},{0,1}};
for(int k=0;k=0 && newr =0 && newc
@@aniketrai9643 Same lol
can you kindly share your code
i solved this question on my own, by watching the previous video, thank you so much.
This is undoubtedly the best content out there on the internet to learn graph problem. I was able to solve this problem without looking at the solution.
I was intimidated by graph problem but now it's safe to say that I am really enjoying them.
I am super grateful for your work Raj.
Thank you so much!
In love with this graph series, so far it's been very easy journey and it's just because of your teaching striver, thank you so much !!
I literally backtracked to like the videos after completing the series and stopped here😅.
Loved it!!! UNDERSTOOD
Thank you so much Striver bhaiya. Earlier I was so scared of graphs but now I am able to solve questions on my own thank you so much. I am so grateful to you for this valuable content 🤗
Thank You for such a wonderful graph series, just addicted to solving graph problems ❤
Thanks so much. I'm following your graph series and this was one of the tough topics for me. I was able to solve this problem without watching this video. All other videos are also great for understanding. I never thought i would be able to solve any graph problem on my own. !!! thanks again.
Understood! What a super amazing explanation as always, thank you very much!
I solved it without even seeing your solution, using DFS as you taught in previous video. Thanks Striver.
Solved the problem without even looking at the video only because of you Striver !! Thanks !!
the largest treasure for graph series..tqsm for making such an amazing series...
I doesn't even know detail or an intermediate about dfs and bfs but the explanation that you had made was pretty much cool. Thank you sir for providing such content.
I solved this problem without even watching the video.
Thank you so much striver for making such a tough topic my cup of tea.
was too afraid of graph earlier. but as soon as started this series, intutions got stronger. Now as the lectures are increasing, i'm more able to solve questions.
Similar to the last question ,hence building an intuition was easier .Thanks
Finally Solved Myself the whole question without looking into the solution even for a second. thank u❤
Really sir you make graph very easy and you can teach any tough concept of world in very simple manner . Thank you so much Striver sir.
Solved the question by myself without starting the video!! thank you so much for this series striver
Understood I could do it using dfs because I understood the last video on Surrounded region . Thanks for great Logic..
Amazing question selection!!!all are linked to each other
I solved this problem even without watching the lecture I am able to get the intuition thanks striver
Solved this Surrounded Regions Intuition 😁😁😁😁
I was able to solve the whole question without even looking at solution thank you for such amazing quality content
I solved the problem with same intuition of DFS on surrounded region it's actually almost same .thank striver ❤
2nd problem solved by me..THANK YOU STRIVER BHAIYA..AAP TO DEVTA HAI🙌
Great sir ji, Kaash life bbhi itni hi asani se samjh aa jaati🙂
Solved this problem on my own based on previous problem intuition 💯.
very easy explanation. Hope to learn more from you
Awesome, was able to get the intuition and solve without watching the solution based on previous video..
He solved that problem by dfs here he did it with bfs
ONE CHANGE (REQUIRED),I think we can check whether it is visited or not after popping from queue also , in this we need not required to start from boundary all the time
i could do this question by myself, thanks striver
understood , last wala hi itna sahi samjhaya ye wala video hi nahi dekhna pada did on my own
I really got to know the meaning of "if it works don't touch it" quote, here it is applicable at 14:32 , you can see that in line 53.
instead of && , & worked because they were both true (1) and 1 &1 =1 =true .
Thank you Striver, Becoz of you I solved this problem on my own. 😁
Thank you very much for your best explanation.
i applied dfs without watching videos,this would only happened becuase of previous videos ,thanks striver bhaiya ,bhagwan aapka bhala kre 🙏🙏
Could able to solve the problem on my own you are really taking us forward
Thank you striver bhaiya. Solved the problem on my own. But still watched whole video.
Was able to do this without watching the lecture. Getting the intuition slowly, one step at a time! Thanks Striver.
One thing I must learn is to write the code in such a way that there is no chance of syntax and logical errors ! and my code runs in one go
Hats off to your explanations !! Helped me a lot , thank you so much !!
understood, did it in the first go without watching the video, because of previous videos
Understood. wonderful videos. so clearly explained. kudos to you :)
i was able to solve this qestion on my own ,thank you striver
Thank you sir 😊
Understood bhaiya❤😊
I solved it on my own ... Thanks Bhaiya ❤.
Thank you very much. You are a genius.
Understood, Thank you so much.
Solved it using DFS based on Concept of Surrounding regions
Understood Bhaiya...
Understood bro.
Why we did not traverse on perimeter and sunk all the lands by marking them 0 connecting to perimeter with DFS? in the end, we check how many 1s are there in the grid and return the ans. It will save space too. What was the risk?
We usually don’t tamper with the data, we just return the final form of transformation which is needed.
Imagine in a real life scenario, you are asked to modify some data, and in order to modify those specific points, you use a logic which harms others, it fixes it afyerwards, but it does harm it for some time, so we don’t do it 😄
@@takeUforward understood. The moto is not only to solve the problems but also to be a clean coder 😀
As he has said many times before, you shouldn't be altering the data given as that's how things work in real life as well. Therefore, used the vis array for checking. Your approach is right and would give you the result as well.
Thankyou sir Understood sir ❤🙇♂🙏
understood bhaiya .......wonderful explanation
i did such a silly mistake debug karte karte time laggaya .. yr...Arigato bhaiya
silly mistakes bhut time khaa jaati hai bhai
@@sumerrawat6947 ha bro..🥲
Understood, Thank you
terrific explanation
Great explanation 👍
understood striver
did this on my own after getting the intuition
great explanation as always
even without watching the lecture I am able to solve the problem on my own
understood!!
solved it on my own :)
it was my first qsn which i solved without watching the soln
amazing explanation!!
Understood Sir!
bhrata shri, what if we need to return the no. of islands/enclave-groups? 🤔
Understood, thanks!
Understood❤
I solved it using dfs on my own Im very happy haha😅
understood💙💙💙
Is anyone getting TLE by dfs approach discussed in previous lecture approach?
yes
@@Amitkumar-br8ro were u able to resolve it??
Nope
Understood:)
Revisit:)
Great Video
Understood 😃
It's liteally the same question as the last one (previous video of the playlist)
i solved this without watrching tutoarial , just refered the prev video by myself and tried ,, and it submitted in one
Thank you
you know guys i tried this question by using dfs so that i take a visited 2d matrix but if i take a visited 2d matrix i get time limited exceed but when i manipulate the same grid data my code submit successfully by the way great explanation
i mention both the code here
void dfs(int row,int col,vector&grid,int n,int m)
{
grid[row][col]=0;
int drow[]={-1,1,0,0};
int dcol[]={0,0,-1,1};
for(int i=0;i=0 && r=0 && c
TLE is not due to the use of a visited matrix it might be due to not passing the grid matrix by reference.
solved without watching video thanks
Thank U soo Much
yes
UNDERSTOOD
understood sir
Understood!
its just a piece of cake too.
UNDERSTOOD;
Able to solve on my own
understood!
isnt it the same as surrounded regions , just make a counter at the end how many 1s are left in grid
its showing runtime error. WHY????
hey , i am getting memory limit exceeded on the last test case.Through DFS.can someone please help
I dont know why but instead of using the nested loops when i use 2 seperate loops similar to the previous video it gives wrong answer for this ip 0 0 0 0
1 0 1 0
0 1 1 0
0 0 0 0
expected output is 3 but it gives 0 when i use individual loops for bfs call.
Bhaiya by using DFS ,
TLE de rha hai
In last two case me de rha hai
Working DFS :
void fill(vector &grid,int row,int col,int delRow[],int delCol[]){
grid[row][col] = 0;
for(int i=0;i=0 && nRow=0 && nCol
It is very much similar to the rotten oranges problem🤔.
Understood sir