Given two sparse integer matrices A
and B
. Return the result of AB
.
This is a companion discussion topic for the original entry at https://algo.monster/problems/sparse_matrix_multiplication/
Given two sparse integer matrices A
and B
. Return the result of AB
.
Note that sparse matrice typically use different data structures that store only (or mainly) the nonzero elements.
The time complexity of this solution (without sparse data structures) is O(A_row * B_col * B_row).