TradeZero interview question

Had to solve a coding test for “chess knight moves”