Description

Given twoSparse MatrixA and B, return the result of AB.

You may assume that A's column number is equal to B's row number.

Have you met this question in a real interview?

Yes

Problem Correction

Example

A = [
  [ 1, 0, 0],
  [-1, 0, 3]
]

B = [
  [ 7, 0, 0 ],
  [ 0, 0, 0 ],
  [ 0, 0, 1 ]
]


     |  1 0 0 |   | 7 0 0 |   |  7 0 0 |
AB = | -1 0 3 | x | 0 0 0 | = | -7 0 3 |
                  | 0 0 1 |

solution

https://www.jiuzhang.com/solution/sparse-matrix-multiplication/\#tag-highlight-lang-cpp

results matching ""

    No results matching ""