Clear Street interview question

Machine coding round involving a grid