Google Interview Question

Working with matrices