# Question

Formatted question description: https://leetcode.ca/all/311.html

```
311 Sparse Matrix Multiplication
Given two sparse matrices A and B, return the result of AB.
You may assume that A's column number is equal to B's row number.
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 |
```

# Algorithm

Make sure that `A[i][k]`

is not 0 before continuing to calculate, and then traverse the kth row of matrix B. If `B[K][J]`

is not 0, accumulate the result matrix `res[i][j] += A[i][k] * B[k][j]`

, so that we can efficiently calculate the multiplication of the sparse matrix.

# Code

Java