Sample Input #1
shift({'a','b','c','d','e'})
Sample Output #1
{'b','c','d','e','a'}
public class ShiftElements {
static char[] testcase1 = {'a', 'b', 'd', 'c', 'b', 'd', 'c'};
public static void main(String args[]) {
ShiftElements testInstance = new ShiftElements();
char[] result = testInstance.shift(testcase1);
System.out.println(result);
}
public char[] shift(char[] elements) {
if (elements.length >= 2) {
int temp = elements[0];
for (int i = 0; i < elements.length - 1; i++)
elements[i] = elements[i + 1];
temp = elements[elements.length - 1];
}
return elements;
}
when i am trying to run testcase it failed my input {'b','c','d','e','a'}'
. my output {'c','d','e','a','a'}
correct output {'c','d','e','a','b'}
.what to do?