Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

(This question is a variation of the LeetCode question 311. Sparse Matrix Multiplication. If you haven't completed that question yet, it is recommended to solve it first.)

A sparse matrix is a two-dimensional array in which most elements are zero. Storing such matrices in their original form can waste a significant amount of space. To address this, design a class that efficiently stores sparse matrices while supporting key operations such as addition and multiplication using minimum space.

Test Cases
Input
Output
Expected