Generation

generate functionTue, 24 Jan 2023

how to shift an array to the right

int[] shift(int[] array) { int[] result = new int[array.length]; int len = array.length; result[0] = array[len - 1]; for(int i = 1; i < len; i++) { result[i] = array[i - 1]; } return result; }

Want to kickstart your project?Use the new AI Studio to create your code