← Questions

Multiply two sparse matrices

0
AppleCodingLast asked May 2026

Multiply two matrices that are mostly zeros. Skip the zero entries: store only the non-zero values of each matrix (by row or as lists of positions) and multiply only those pairs. Compare the cost with the plain triple loop.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding