β Lexographical Rotation (Contest)
Lexographical Rotation (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
```java
import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework
// don't change the name of this class
// you can add inner classes if needed
class Main {
public static void main (String[] args) {
Scanner scan=new Scanner(System.in);
int n= scan.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++){
arr[i] = scan.nextInt();
}
int minIndex=0;
for(int i=1;i<n;i++){
if(arr[i]<arr[minIndex]){
minIndex=i;
}
}
// Your code here
for(int i=0;i<n;i++){
System.out.print(arr[(i + minIndex)%n]+" ");
}
}
}
```Last updated