J.P. Morgan Interview Question

Coding a rotating grid thing