← 返回 linkedin 的题目列表Sparse Matrix Multiplication
类型:online_judge
Given two sparse matrices A and B, return their product. Matrix A has dimensions m x k, and matrix B has dimensions k x n. The resulting matrix C should have dimensions m x n. As most elements in the matrices are zero, avoid unnecessary multiplications and storage of zeros. Example input includes data for two sparse matrices and output should be the product matrix.
Example
Input
2 3
0 0 1
0 0 0
3 2
1 0
0 0
1 0