You explained the optimized part in the best way from all the videos on youtube, thanks!
@bhavyaagrawal70982 ай бұрын
finally understood the last method 😭 it took my day while learning from striver
@nikoo282 ай бұрын
Glad it helped!
@mondeepchetry30952 ай бұрын
literally, i was having a hard time learning the optimal solution from striver, that shit was like some rocket science to understand.
@nikoo2824 күн бұрын
everyone has a different style of explaining. Sometimes striver might click better for you...other days it could be mine :)
@Tapadar.Monsur Жыл бұрын
Please continue with more array questions. Your explanation is top notch.
@tanveerabbas26 Жыл бұрын
that is the only video where I could understand intuition
@baksonyan4ik11 ай бұрын
Я скачал leetcode Torture (расширение для гугла), после чего там далась эта задача, которую я не мог решить в течении часа, (потому что я не когда не заходил на leetcode) но вы обьяснили эту задачу так быстро и проффесионально. Большое спасибо! I downloaded the Leetcode Torture extension, and then I got this stupid problem that I was struggling with, like, for an hour, but you've solved it in just 20 minutes, and that quickly and professionally... with explained every step of the process. Thank you very much
@nikoo2811 ай бұрын
Да, рассмотрение проблемы с помощью визуальных эффектов очень помогает. Я так рад, что это было полезно для вас.
@unknownman17 ай бұрын
I really like how you've arranged the videos in your playlist. The upcoming videos are somewhat related to the concepts learned in the previous lessons. Thanks!
@nikoo286 ай бұрын
Glad you like them!
@sachinsoma575711 ай бұрын
You are a great teacher. That was the best explanation I found so far. Keep teaching.
@nikoo2811 ай бұрын
Thank you, I will
@rdrahuldhiman193 ай бұрын
Amazing explanation, got the understanding of firstRow and firstCol when I got stuck with the leetcode example where there is only a single 0 in middle of the matrix. Thanks.
@amanverma8258 Жыл бұрын
Wonderful explanation! Finally got it, sir
@palspal2329 Жыл бұрын
Only you were able to explain it clearly for me, thanks brother
@nikoo28 Жыл бұрын
so happy to hear that.. :)
@anandchauhan18688 ай бұрын
finally after watching many lecture your video is recommended and it's very helpful and clear my concept
@Hayat26474Ай бұрын
please upload all dsa question , your explaination is best sir
@nikhilagrawal92172 ай бұрын
Very clear explanation!!. Thanks a lot.
@codingwave565 ай бұрын
Thanks Helpful!
@NITISHKUMAR-ng4pu2 ай бұрын
if there is no row or column that has 0 in it and we updated 0 in it from another element then how can we use 1st row and column to make change in whole row and column
@jedex9911 ай бұрын
we are with u sir thanks for make it so much easy soln
@parthanuj8611 Жыл бұрын
kya baat hai sir maja aa gaya . loved this
@ElectronaMusic14 күн бұрын
thanks!
@pratyakshamaheshwari8269 Жыл бұрын
Another solution without using extra space Start row wise first. Select rows one by one and make all the elements of that row -1 except which are 0, if any element in that row is 0. Similariy you have to do the same thing for columns. Now, before returning traverse the matrix and make all the -1 elements 0. public class Solution { public int[][] solve(int[][] A) { int n = A.length, m = A[0].length; for(int i = 0; i < n; i++){ int flag = 0; for(int j = 0; j < m; j++){ if(A[i][j]==0)flag = 1; } if(flag == 1){ for(int j = 0; j < m; j++){ if(A[i][j] != 0) A[i][j] = -1; } } } for(int j = 0; j < m; j++){ int flag = 0; for(int i = 0; i < n; i++){ if(A[i][j]==0)flag = 1; } if(flag == 1){ for(int i = 0; i < n; i++){ if(A[i][j] != 0) A[i][j] = -1; } } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(A[i][j] == -1)A[i][j] = 0; } } return A; } }
@GaganSingh-zz9el8 ай бұрын
marking them -1 doesnot increase time complexity ??
@sachinsoma575711 ай бұрын
The only part I was confused is the for(int i = 1;i
@nikoo2811 ай бұрын
We only start from i=0 and j=0 for the first for loop, that is when you are setting the markers. After that if you observe the second for loop, we are starting from i=1 and j=1. If you go through the explanation again, we do this so we can use the first row and column to see if there is a zero anywhere in the respective row/column. Hope this helps.
@sachinsoma575711 ай бұрын
@@nikoo28 Thanks, understood
@SadhanaSharma11 ай бұрын
Thank you sir... this is just an amazing approach
@Honest_ViewАй бұрын
Sir, Why we are using Matrix[0].length & Matrix.length in some for loops? What is the difference between them
@abhijnasankesha51829 ай бұрын
Thanks
@b_01_aditidonode433 ай бұрын
amazing explanation sir!!
@shravanthombre3407 Жыл бұрын
great explanation!!
@nikoo28 Жыл бұрын
Glad you liked it!
@nikhil2373 Жыл бұрын
Very good explanation, please used to upload frequently, or if you have any community discord or other please tell us
@nikoo28 Жыл бұрын
I don’t have a discord yet…but can explore about it. Can you tell me its advantages and how it will be helpful to my viewers?
@haripriyaveluchamy944911 ай бұрын
your explanation is too good keep rocking
@nikoo2810 ай бұрын
Thank you so much 🙂
@saurabhruikar3196 Жыл бұрын
Please do upload videos regarding graph algorithms your explanation style will make it easy to understand.
@nikoo28 Жыл бұрын
Sure…I am prepping up some material for it. Graphs are a little tricky…so need a little extra time to simplify them.
@fffooccc9801 Жыл бұрын
@@nikoo28 I have a doubt. It is for sure that we can't use the nested loop to iterate but while marking for zeros we have used a nested loop can u please solve my doubt.
@nikoo2805 Жыл бұрын
@@fffooccc9801 you will have to iterate over each element in the matrix atleast once, and it cannot be done without a nested loop. It is the levels of nesting that you want to reduce…you should only have one nested loop..not more than that.
@nikoo286 ай бұрын
The complete playlist on graphs is now available: kzfaq.info/sun/PLFdAYMIVJQHNFJQt2eWA9Sx3R5eF32WPn
@mohitahlawat4556 ай бұрын
Great sir ❤
@Dhruv_Sharma_12310 ай бұрын
Thanks understood
@xinyangli71034 ай бұрын
sorry have a question, why is this a constant space solution where there are nested loops multiple times? thanks so much
@nikoo284 ай бұрын
just using loops does not mean extra space. You are said to be taking extra space when you are using extra memory equivalent to your input size.
@JohnSmith-uu5gp Жыл бұрын
Great !!!!!
@curtdudeanmol9393 Жыл бұрын
this gives incorrect Answer for this result matrix : [[1],[0],[3]] expected : [[0],[0],[0]] output: [[0],[0],[3]] --> this is in leet code , code which I wrote is below , let me know where I made mistake boolean firstRow = false, firstCol = false; // Set markers in first row and first column for(int i=0; i
@nikoo28 Жыл бұрын
try adding print statements in your code to debug, you will then be able to see the state of your matrix at certain stages. That should help to figure out
@curtdudeanmol9393 Жыл бұрын
@@nikoo28 thanks for the reply, figured out the mistake, while checking for 1st column have been comparing I==0 , hence giving wrong answer .
@infinite639 Жыл бұрын
Teaching mast hai bhai aapki
@nikoo28 Жыл бұрын
Let me what other type of questions/topics you want to see.
@infinite639 Жыл бұрын
@@nikoo28 Please make on Arraylist and linkedlist questions And Graphs, dynamic programming, hashset , hashmap
@infinite639 Жыл бұрын
@@nikoo28 i will send you the questions one by one
@nikoo286 ай бұрын
The complete playlist on graphs is now available: kzfaq.info/sun/PLFdAYMIVJQHNFJQt2eWA9Sx3R5eF32WPn
@yomamasofat41314 күн бұрын
after doing so many leetcode questions like these, sometimes I feel like programming is all these hacks and tricks to make things more efficient. Anybody feels the same way?
@Lord_bobby_7 ай бұрын
even in the second and third solution Time complexity is M*N , cant we reduce the time complexity to M+N ??
@nikoo286 ай бұрын
that will not be possible, because in the worst case you will have to convert all elements to 0. which means going over each element, and that is O(m * n)
@honey-xr5kp5 ай бұрын
wow i really dont like matrix problems. the best solution uses 2 nested for loops and 2 more for loops
@nikoo284 ай бұрын
Yes, matrix problems are very wonky.
@prapti2385Ай бұрын
The solution is wrong. Also why did you convert all the remaining elements to zero in the last step? If you take the example from striver's video he particularly said about that element.
@nikoo28Ай бұрын
what do you mean when you say the solution is wrong? The solution passes all the given test cases on LeetCode.