Outstanding explanation Previously I was confused in 3rd approach but after watching the video it is crystal clear wright now Thank you soo much Alisha
After not understanding code from striver, I understood the solution from this channel. Thanks for it. Though I'm still facing some difficulties in coding and understanding but I looked at solution for 4-5 times and I'm getting better. Thnx
Great explanation again, I had watched around 5-10 videos before this but was only able to understand it after ur video. I wish this channel gets the recognition it deserves
Recently I found your channel, and honestly whenever I get stuck at some problem after watching some famous youtuber's explanation also I come here to see yours. I really love the way you explain ❤️
Definitely the best explanations, striver has explained the same concepts but the way he explains them seems difficult. You made this problem look so easy
I watched over 4 videos but didn't understand any, I was finally able to grasp the concept after watching your video. Please keep up the good work. Thank you
this explanation was so so good!! such an underrated channel. tysm for this content. After not understanding from striver, I came here and I was able to understand so well!
Thank you so mush Alisha... I just watched the entire video once and written code in java ...With the 1st attempt only it got Submited.. The way you explained the concept is very nice. Thank you so much...
What a great explanation Alisha. 😊😊😊😊 After watching the concept, I opened leetcode and wrote the code. It worked in first go. Then came back here to see your code. It is almost same. Just to add, in the first two for loops i.e. to mark x and y as zero, we can break the loop. Here is my code: class Solution { void setRowColumnZeroes(int[][] matrix){ boolean isFirstRowHasZeros = false, isFirstColumnHasZeros = false; int rows = matrix.length, columns = matrix[0].length; for(int i = 0; i < columns; i++){ if(matrix[0][i] == 0){ isFirstRowHasZeros = true; break; } } for(int i = 0; i < rows; i++){ if(matrix[i][0] == 0){ isFirstColumnHasZeros = true; break; } } for(int i = 1; i < rows; i++){ for(int j = 1; j < columns; j++){ if(matrix[i][j] == 0){ matrix[0][j] = matrix[i][0] = 0; } } } for(int i = 1; i < columns; i++){ if(matrix[0][i] == 0){ int row = 1; while(row < rows){ matrix[row][i] = 0; row++; } } } for(int i = 1; i < rows; i++){ if(matrix[i][0] == 0){ int column = 1; while(column < columns){ matrix[i][column] = 0; column++; } } } if(isFirstRowHasZeros){ for(int i = 0; i < columns; i++){ matrix[0][i] = 0; } } if(isFirstColumnHasZeros){ for(int i = 0; i < rows; i++){ matrix[i][0] = 0; } } } }
Very good explanation dear, especially when you have gone from most obvious solution and why we cannot use it to the most optimum solution. So we will never make that mistake when we redo the question. Also I really like when you didn't gave a very difficult code as answer for first timer to understand it. Please keep doing it 😊
I submitted the same code. When I ran the code, it said accepted but when I entered the submit button, it said wrong answer. Someone Please explain why.....
One correction, in the video not in the code: In video you told, first to solve the inner 3*3 matrix and after that we don't have to care of them and after that we will look into the 1st row and the first column and when we see any 0 there then mark whole row or whole column as 0. but I guess the order should be reversed and first we should mark in the 1st row and column, because if we solve for the inner matrix first then obviously the 1st row and column will contain 0 for sure. so the correction is that beforehand only we should put markers in the 1st row and column then solve the inner matrix, which you did in the code.
Code CPP:
int m =matrix.size();
int n = matrix[0].size();
int x =1;
int y =1;
for(int j=0;j
Outstanding explanation
Previously I was confused in 3rd approach but after watching the video it is crystal clear wright now
Thank you soo much Alisha
But the time complexity remains O(mn), isn't it.
@@ANKITKUMAR-iy4he for 2 d matrix time complexity always m*n here main motive to reduce space complexity to constant 🙂
bhai time complexity ?
After not understanding code from striver, I understood the solution from this channel. Thanks for it. Though I'm still facing some difficulties in coding and understanding but I looked at solution for 4-5 times and I'm getting better. Thnx
same here bro i camed from striver sde sheet/course
same
yeah the last approach were he did in O(1) space was unclear.
@@pawxnsingh how many questions per day from striver sheet should be done
yeah bro !
Great explanation again, I had watched around 5-10 videos before this but was only able to understand it after ur video. I wish this channel gets the recognition it deserves
Recently I found your channel, and honestly whenever I get stuck at some problem after watching some famous youtuber's explanation also I come here to see yours. I really love the way you explain ❤️
Thank you so much Sayan
Best video of this question. Amezing explanation
Definitely the best explanations, striver has explained the same concepts but the way he explains them seems difficult. You made this problem look so easy
I watched over 4 videos but didn't understand any, I was finally able to grasp the concept after watching your video. Please keep up the good work. Thank you
What an explanation 💯💯 times better then striver and everyone over there on TH-cam. Got it in the first run through itself.
this explanation was so so good!! such an underrated channel. tysm for this content. After not understanding from striver, I came here and I was able to understand so well!
Your enthusiasm while explaining deserves more views for your Hardwork.
Love it yar pehle 3 ghante dekha is video ko samajh nahi aaya fir subha subha uthke fir dekh 2 bari me samajh aa gaya
I watched many videos for understanding this problem, You gave the best explanation to this problem. Subscribed 👍
Thanku👍👍👍👍
This is the best best explanation ever i have seen thanks a lot mam..♥️
Thank you so mush Alisha... I just watched the entire video once and written code in java ...With the 1st attempt only it got Submited.. The way you explained the concept is very nice. Thank you so much...
The way you vizulasing and teaching us it's incredible heads of you😊
Thanks didi. I didn't understand after watching videos of popular youtubers but completely understood in one pass after watching this explanation.
Watched 3 videos didn't understand this method. Watching your video i understand it in one attempt. Thanks a lot 💫
Best explanation that I found on the internet for this problem.
How can someone explain so well ? No room left for any doubt. Thank you so much☺️🙏🙏
hands down you're the best
Accidently landed to this video and I must say your channel is underrated.. Full marks on the neat explaination!
Thanks for the details video. Your efforts are appreciated
mam amazing explanation,i wasn't able to understand this question from striver, you explained it amazingly!!!
Didi you put so much effort in explaining this ques. i am glad i clicked your video first , my lots of time is saved.
You explain beautifully without complexing it.❤
Great explaination didi. I understood the problem really well.
So underrated channel....such a gem content
Thanks, striver's explanation was too confusing, finally understood!
What a great explanation Alisha. 😊😊😊😊 After watching the concept, I opened leetcode and wrote the code. It worked in first go.
Then came back here to see your code. It is almost same.
Just to add, in the first two for loops i.e. to mark x and y as zero, we can break the loop. Here is my code:
class Solution {
void setRowColumnZeroes(int[][] matrix){
boolean isFirstRowHasZeros = false, isFirstColumnHasZeros = false;
int rows = matrix.length, columns = matrix[0].length;
for(int i = 0; i < columns; i++){
if(matrix[0][i] == 0){
isFirstRowHasZeros = true;
break;
}
}
for(int i = 0; i < rows; i++){
if(matrix[i][0] == 0){
isFirstColumnHasZeros = true;
break;
}
}
for(int i = 1; i < rows; i++){
for(int j = 1; j < columns; j++){
if(matrix[i][j] == 0){
matrix[0][j] = matrix[i][0] = 0;
}
}
}
for(int i = 1; i < columns; i++){
if(matrix[0][i] == 0){
int row = 1;
while(row < rows){
matrix[row][i] = 0;
row++;
}
}
}
for(int i = 1; i < rows; i++){
if(matrix[i][0] == 0){
int column = 1;
while(column < columns){
matrix[i][column] = 0;
column++;
}
}
}
if(isFirstRowHasZeros){
for(int i = 0; i < columns; i++){
matrix[0][i] = 0;
}
}
if(isFirstColumnHasZeros){
for(int i = 0; i < rows; i++){
matrix[i][0] = 0;
}
}
}
}
really helpful !!! nice approach and explaination.
The explanation is extremely good , Thank you so much
You are the best thank you so much for simplifying things 🙏🙏🙏
Very nicely explained , thanks a lot..
thank you Alisha , honestly when i face any problem to solve question , first i used to find out it on your channel
Really great explanation . I have seen many videos but unable to understand their explanation . But you made that crystal clear to me. Thankyou
Hey Alisha your way of explanation is much better than striver. Bas thoda slow bola karo
Nicely explained. This explanation was better than striver's explanation for same problem.
Thank you .. yours explanation was best 😊😊❤
loved the explanation...keep up the good work....
Great sister best explanation keep it up 🔥🔥🔥🔥
Best explanation!
Hands Down.
Superb explanation 👌
Please make more videos on problem solving, leetcode problems, your explanations are super cool, I eagerly wait for the videos.
thank you for the explanation, may god bless you.
Alisha is good teacher..i can easily under stand
very Nice explanation....understood finally🙃
You are too good at teaching ❤
U should not settle less than google ,u are awesome seriously
you explained it so easily , seriously thank uh
Best Explanation, Watched various video, but in this video all the doubts get cleared.. 💯💯🌈
Kyo big chasma pahna tha
Superb Explanation 👍
Great, lovely explanation that make me confident ❤️❤️
Really Nice Explaination
you always come with good explanation
Thanks for making matrix question easy 😄, great explanation
your explanation is so easy. make more videos ...
COMMENTED APPROACH !!!
void setZeroes(vector& matrix)
{
int rows = matrix.size();
int cols = matrix[0].size();
// for the first row & first col set x=1 & y=1 respectively as flag values.
int x=1, y=1;
//iterating first col
for(int i=0; i
thnx
great explanation alisha
great Explanation....thankyou
masttt smjhayaa
Excellent explaination
Well explained..
Very good explanation dear, especially when you have gone from most obvious solution and why we cannot use it to the most optimum solution. So we will never make that mistake when we redo the question. Also I really like when you didn't gave a very difficult code as answer for first timer to understand it. Please keep doing it 😊
awesome explanation, very good
thank you didi wonderful explanation
Excellent solution
Best Explanation.
Youre doing great job
Great explanation 🛐
Exceptional Explanation.
sooo good and easily understandable diii...loved it, thankyou so much
Thanks ruhi ❤️
Crystal clear. Again.
Thanks
much better explanation then striver
Very helpful video
Thank you so much for a very easy to understand explanation.
Such an amazing approach! Thanks a ton!
Thanks for such a good explanation 🙏🙏
I loved the explaination, thank you
best expalanation ever
Great Explanation!!
Nice Explanation :)
Your English is lit❣️❣️❣️
Well explained!
nice explanation
better then striver explanation definately :)
I just came here after seeing lot of complexity in striver video. For this problem he unnecessarily complexed it.
Very clear explanation!
thanks for the explanation
please add video of spiral matrix it will be very helpful
awesome di
u explained very very well!
Thanks for explanation👍
Thanks Alisha ♥️
Nice🔥🔥🔥🔥
What would be the TC for the problem? Btw this is the most intuitive solution I have come across.
Nice 💯🎉
nice explanation didi
I submitted the same code. When I ran the code, it said accepted but when I entered the submit button, it said wrong answer. Someone Please explain why.....
Perfect 👌
One correction, in the video not in the code:
In video you told, first to solve the inner 3*3 matrix and after that we don't have to care of them and after that we will look into the 1st row and the first column and when we see any 0 there then mark whole row or whole column as 0.
but I guess the order should be reversed and first we should mark in the 1st row and column, because if we solve for the inner matrix first then obviously the 1st row and column will contain 0 for sure.
so the correction is that beforehand only we should put markers in the 1st row and column then solve the inner matrix, which you did in the code.
well explained , could u provide pseudo code for brute force where u have use 2 arrays as a marker , would really appreciate it?