how to rotate array java recursively

Solutions on MaxInterview for how to rotate array java recursively by the best coders in the world

showing results for - "how to rotate array java recursively"
Leon
26 Apr 2020
1private static void rotateLeftOne(char[] arr, int length, int num) {
2	int pos = length - num;
3	if (pos != length - 1)
4	{
5		char temp = arr[pos];
6		arr[pos] = arr[pos + 1];
7		arr[pos + 1] = temp;
8		rotateLeftOne(arr, length, num - 1);
9	}
10}