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
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
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 ❤️
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
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.....
if the array is [1 1 1, 1 1 1 , 0 1 1] x will become 0 now all element remain untouched and at last loop for x==0 , at that loop it will set zero for row ,but not for the columns why ? how these columns would set zero plz reply
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 🙂
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
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
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
What an explanation 💯💯 times better then striver and everyone over there on CZcams. Got it in the first run through itself.
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
Your enthusiasm while explaining deserves more views for your Hardwork.
Accidently landed to this video and I must say your channel is underrated.. Full marks on the neat explaination!
Watched 3 videos didn't understand this method. Watching your video i understand it in one attempt. Thanks a lot 💫
Thanks didi. I didn't understand after watching videos of popular youtubers but completely understood in one pass after watching this explanation.
Really great explanation . I have seen many videos but unable to understand their explanation . But you made that crystal clear to me. Thankyou
How can someone explain so well ? No room left for any doubt. Thank you so much☺️🙏🙏
Best explanation that I found on the internet for this problem.
Best video of this question. Amezing explanation
Such an amazing approach! Thanks a ton!
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...
So underrated channel....such a gem content
you explained it so easily , seriously thank uh
thank you Alisha , honestly when i face any problem to solve question , first i used to find out it on your channel
thank you for the explanation, may god bless you.
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;
}
}
}
}
The way you vizulasing and teaching us it's incredible heads of you😊
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
Great, lovely explanation that make me confident ❤️❤️
mam amazing explanation,i wasn't able to understand this question from striver, you explained it amazingly!!!
Very nicely explained , thanks a lot..
You are the best thank you so much for simplifying things 🙏🙏🙏
Thank you so much for a very easy to understand explanation.
Thanks for the details video. Your efforts are appreciated
I watched many videos for understanding this problem, You gave the best explanation to this problem. Subscribed 👍
Thanku👍👍👍👍
Best explanation!
Hands Down.
really helpful !!! nice approach and explaination.
The explanation is extremely good , Thank you so much
You explain beautifully without complexing it.❤
Thanks, striver's explanation was too confusing, finally understood!
hands down you're the best
Thank you .. yours explanation was best 😊😊❤
This is the best best explanation ever i have seen thanks a lot mam..♥️
Thanks for making matrix question easy 😄, great explanation
Alisha is good teacher..i can easily under stand
great explanation alisha
Thanks for such a good explanation 🙏🙏
I loved the explaination, thank you
Crystal clear. Again.
Thanks
Please make more videos on problem solving, leetcode problems, your explanations are super cool, I eagerly wait for the videos.
Superb explanation 👌
awesome explanation, very good
Youre doing great job
Really Nice Explaination
you always come with good explanation
Excellent explaination
Well explained..
Didi you put so much effort in explaining this ques. i am glad i clicked your video first , my lots of time is saved.
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 😊
U should not settle less than google ,u are awesome seriously
Nicely explained. This explanation was better than striver's explanation for same problem.
loved the explanation...keep up the good work....
isme while making the entire row and column 0 can we tak for loop from i =0 instead of i =1
Great explaination didi. I understood the problem really well.
You are too good at teaching ❤
Exceptional Explanation.
well explained , could u provide pseudo code for brute force where u have use 2 arrays as a marker , would really appreciate it?
what is the time complexity for the optimised solution
very Nice explanation....understood finally🙃
Great sister best explanation keep it up 🔥🔥🔥🔥
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.....
your explanation is so easy. make more videos ...
u explained very very well!
Very clear explanation!
Great Explanation!!
great Explanation....thankyou
awesome di
Best Explanation, Watched various video, but in this video all the doubts get cleared.. 💯💯🌈
Kyo big chasma pahna tha
Great explanation 🛐
Superb Explanation 👍
how can we push the 2 arrays inside the main array? like I don't understood this part
thanks for the explanation
Thanks for explanation👍
Very helpful video
understood thank you
Well explained!
nice explanation
thank you didi wonderful explanation
Best Explanation.
Nice Explanation :)
very well taught
what is the time complexity of the final solution
Thanks Alisha ♥️
In this optimize approach method ->Suppose inner matrix is not zero in particular problems what I do ? Please explain me mam....
Thank you
What would be the TC for the problem? Btw this is the most intuitive solution I have come across.
masttt smjhayaa
Ma'am this code is not giving runtime error. What is the more optimised way to solve this
best expalanation ever
Explanation ❣️🔥
if the array is [1 1 1, 1 1 1 , 0 1 1]
x will become 0
now all element remain untouched and at last loop for x==0 , at that loop it will set zero for row ,but not for the columns why ? how these columns would set zero plz reply
sooo good and easily understandable diii...loved it, thankyou so much
Thanks ruhi ❤️
please add video of spiral matrix it will be very helpful
much better explanation then striver