Non-Adjacent Element Rearrangement - Coding problem | OneNoughtOne