Generate All Arrangements - Coding problem | OneNoughtOne