Thanks for this explanation. Essential computation is done in the most inner step, which means you can change the order of the loops and it should still give you same result. Based on that, you only need to execute the loop if the value is non-zero. Here is the code for that. Thanks again for the simplified explanation. public int[][] multiply(int[][] mat1, int[][] mat2) { int m1r = mat1.length; int m2r = mat2.length; int m1c = m2r; int m2c = mat2[0].length; int[][] res = new int[m1r][m2c]; for(int i=0; i
Thanks for this explanation. Essential computation is done in the most inner step, which means you can change the order of the loops and it should still give you same result.
Based on that, you only need to execute the loop if the value is non-zero.
Here is the code for that. Thanks again for the simplified explanation.
public int[][] multiply(int[][] mat1, int[][] mat2) {
int m1r = mat1.length;
int m2r = mat2.length;
int m1c = m2r;
int m2c = mat2[0].length;
int[][] res = new int[m1r][m2c];
for(int i=0; i
thank you so much for understanding what I was saying in the video.
This was really clear! Please add the followup
I think you did well, very clear :)
Thanks brother! Keep it up
Understood.
Sparse Matrix. Look that up.
Do you have a video of your solution?
like l0l that's the whole point of the problem... yale method is weird tho
there is no sparse matrix optimization. Change the title since to does not match the content.
You literally have no subscribers - go do something more useful troll
@@nuravrai-ms5ee like i cared about my subscribers man😂
very confusing explanation
Hi siva, did you try the solution in leetcode and understand how the solution works ?