Simulate robot moves on a grid | Shopify Interview Question