Left Rotate the Elements of Array || Programming in Java

preview_player
Показать описание
In this program, we need to rotate the elements of an array towards the left by the n number of times. In the left rotation, each element of the array will be shifted to its left by one position and the first element of the array will be added to end of the list. This process will be followed for a n number of times....
Рекомендации по теме
Комментарии
Автор

int arr[]= {1, 2, 3, 4, 5};
int d=2;

for(int i=1;i<=2;i++) {
for (int j = 0; j < arr.length-1; j++) {
int temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
for(int g=0;g<arr.length;g++) {
System.out.println(arr[g]);
}







bhaiya mera yeh algorithm sahi hai kya
answer same aa raha hai

ankitwatts
welcome to shbcf.ru