QuestionGiven twosparse matricesmat1of sizem x kandmat2of sizek x n, return the result ofmat1 x mat2. You may assume that multiplication is always possible.Example 1:Input: mat1 = [[1,0,0],[-1,0,3]], mat2 = [[7,0,0],[0,0,0],[0,0,1]]
Output: [[7,0,0],[-7,0,3]]Example 2:Input: mat1 = [[0]], mat2 = [[0]]
Output: [[0]]Constraints:m == mat1.lengthk == mat1[i].length == mat2.lengthn == mat2[i].length1 <= m, n, k <= 100-100 <= mat1[i][j], mat2[i][j] <= 100AlgorithmFirst you need to know what's matrix, then you need to know how to do thematrix multiplication.This graph is the key:The logic behind the
...
继续阅读
(13)