WC 6.3 Shuffle the Deck

Given a set of numbers from 1 to N, shuffle the numbers such that the absolute difference between the integer in the array Solution and its position i is equal to the number K.

|Solution[i] – i| = K for every i from 1 to N.

If such an order is not possible, Solution is [-1]. The final answer has to be the concatenation of all arrays.

For example:
Input Format: First integer represents the value of N, the second represents the value of K.
Output Format: Check the sample link below

Sample Input: link

This challenge is worth 100 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Kunal Desai : 7715051136

Neelraj Patil : 9930671144



Privacy Policy