Implement an efficient sparse matrix times vector multiplication. Asked in the AI coding stage.
Write a function that takes a sparse matrix and a dense vector, then returns the product as a list of row sums. The matrix is represented as a list of rows, where each row is a list of [column_index, value] pairs for nonzero entries only.
matrix: List[List[List[int]]]vector: List[int]List[int] where result[i] is the dot product of row i with vector.def sparse_matrix_vector_multiply(matrix, vector):