@@ -0,0 +1,1879 @@
+package test;%0A%0A/**%0Ascala%3E val cars = Array(1, 2, 3, -1, 4, 5)%0Ascala%3E val exp = Array(5, 1, -1, 3, 2, 4)%0Ascala%3E test.Test.shiftCars(cars, exp)%0Ares0: java.util.List%5BInteger%5D = %5B3, 1, 5, 4, 2, 1%5D%0A%0Ascala%3E val cars = Array(1, 2, 3, -1, 4, 5)%0Ascala%3E val exp = Array(1, 2, 3, -1, 4, 5)%0Ascala%3E test.Test.shiftCars(cars, exp)%0Ares2: java.util.List%5BInteger%5D = %5B%5D%0A%0Ascala%3E val cars = Array(1, -1, 2, 3, 4, 5, 6)%0Ascala%3E val exp = Array(1, 4, 5, 3, 2, -1, 6)%0Ascala%3E test.Test.shiftCars(cars, exp)%0Ares7: java.util.List%5BInteger%5D = %5B4, 2, 5%5D%0A*/%0Apublic class Test %7B%0A  Test() %7B %7D%0A%0A  public static java.util.List%3CInteger%3E shiftCars(int%5B%5D cars, int%5B%5D expected) %7B%0A    boolean same = true;%0A    for (int i = 0; i %3C cars.length; i++) %7B%0A      same = same && cars%5Bi%5D == expected%5Bi%5D;%0A    %7D%0A    java.util.List%3CInteger%3E steps = new java.util.ArrayList%3CInteger%3E();%0A    int minusOnePos = -1;%0A    for (int i = 0; i %3C cars.length; i++) %7B%0A      if (cars%5Bi%5D == -1) %7B%0A        minusOnePos = i;%0A        break;%0A      %7D%0A    %7D%0A%0A    while (!same) %7B%0A      if (expected%5BminusOnePos%5D != -1) %7B%0A        int pos = find(cars, expected%5BminusOnePos%5D);%0A        steps.add(cars%5Bpos%5D);%0A        cars%5BminusOnePos%5D = cars%5Bpos%5D;%0A        cars%5Bpos%5D = -1;%0A        minusOnePos = pos;%0A      %7D else %7B%0A        int pos = findFirstDiff(cars, expected);%0A        if (pos %3E= 0) %7B%0A          steps.add(cars%5Bpos%5D);%0A          cars%5BminusOnePos%5D = cars%5Bpos%5D;%0A          cars%5Bpos%5D = -1;%0A          minusOnePos = pos;%0A        %7D else %7B%0A          same = true;%0A        %7D%0A      %7D%0A    %7D%0A%0A    return steps;%0A  %7D%0A%0A  private static int find(int%5B%5D cars, int value) %7B%0A    for (int i = 0; i %3C cars.length; i++) %7B%0A      if (cars%5Bi%5D == value) return i;%0A    %7D%0A    return -1;%0A  %7D%0A%0A  private static int findFirstDiff(int%5B%5D cars, int%5B%5D expected) %7B%0A    for (int i = 0; i %3C cars.length; i++) %7B%0A      if (cars%5Bi%5D != -1 && cars%5Bi%5D != expected%5Bi%5D) return i;%0A    %7D%0A    return -1;%0A  %7D%0A%7D%0A

add solution for shift-cars