Adjacent Node Exchange - Coding problem | OneNoughtOne