Cyclic Shifted Array Lookup with Duplicates - Coding problem | OneNoughtOne