Solve constrained monster traversal | Confluent Interview Question