They asked a leet code style matrix operation question.
Implement rectangle updates and rectangle-sum queries on an integer matrix. Each update adds a value to every cell in an inclusive rectangle, while each query returns the sum of an inclusive rectangle. Return query results in order and avoid iterating over every cell in a rectangle.
Use matrix_operations(matrix, operations); each operation is ['add', r1, c1, r2, c2, value] or ['sum', r1, c1, r2, c2]. Return a list of integers.
def matrix_operations(matrix, operations):