Clear Street Interview Question

Machine coding round involving a grid