@@ -0,0 +1,1094 @@
+/**%0A * %0A */%0Apackage algorithms.implementation;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Scanner;%0Aimport java.util.Set;%0A%0A/**%0A * Challenge: https://www.hackerrank.com/challenges/absolute-permutation%0A * %0A * @author Sudharsanan Muralidharan%0A */%0Apublic class AbsolutePermutation %7B%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A%0A    int t = in.nextInt();%0A    while (t-- %3E 0) %7B%0A      int n = in.nextInt();%0A      int k = in.nextInt();%0A      int%5B%5D p = new int%5Bn + 1%5D;%0A      Set%3CInteger%3E set = new HashSet%3CInteger%3E();%0A      boolean possible = true;%0A%0A      for (int i = 1; i %3C= n; i++) %7B%0A        if (i - k %3E 0 && !set.contains(i - k)) %7B%0A          p%5Bi%5D = i - k;%0A        %7D else if (i + k %3C= n && !set.contains(i + k)) %7B%0A          p%5Bi%5D = i + k;%0A        %7D else %7B%0A          possible = false;%0A          break;%0A        %7D%0A        set.add(p%5Bi%5D);%0A      %7D%0A      %0A      if(possible) %7B%0A        for(int i=1;i%3C=n;i++) %7B%0A          System.out.print(p%5Bi%5D + %22 %22);%0A        %7D%0A      %7D else %7B%0A        System.out.print(-1);%0A      %7D%0A      System.out.println();%0A    %7D%0A    in.close();%0A  %7D%0A%7D%0A

Add solution for AbsolutePermutation