
Integers from 0 to X stored in an array of size X+1. Each integer appears once & only once, but in random order e.g. Consider array of size 5 as below...
Arr[0]=3; Arr[1]=0; Arr[2]=1; Arr[3]=4; Arr[4]=2;
Process the above array as input & output an array where indices & values of the input array are flipped. e.g. Since 0th element of Arr contains 3, value of 3rd element in the output array should be 0. In short, Arr[0]=3 in the input, becomes Arr[3]=0 in the output.

Hello Friend,
Try the following:
class ArrayExample1{
public static void main(String[] args){
int Arr[]=new int[5];
Arr[0]=3;
Arr[1]=0;
Arr[2]=1;
Arr[3]=4;
Arr[4]=2;
for(int i=0;i<Arr.length;i++){
System.out.println("Arr["+Arr[i]+"]="+i);
}
}
}
Thanks

Hello Friend,
Try the following:
class ArrayExample1{
public static void main(String[] args){
int Arr[]=new int[5];
Arr[0]=3;
Arr[1]=0;
Arr[2]=1;
Arr[3]=4;
Arr[4]=2;
for(int i=0;i<Arr.length;i++){
System.out.println("Arr["+Arr[i]+"]="+i);
}
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.