Jane Street interview question

Coding with matrices (leetcode medium)