X Tutup
/* Take last digit of an array and placed it at front. * The process run upto n times by user input * * Input : * ---------------- * 5 * 1 2 3 4 5 * 3 * * Output : * ---------------- * 3 4 5 1 2 */ import java.util.Scanner; public class Array_Rotation { public static void swap(int[] nums,int i,int j){ int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; } public static int[] reverse(int[] nums,int i ,int j){ while (i
X Tutup