Solve Knight and Reversal Problems | Uber Interview Question