Computer Science, asked by haripriyaboddu45, 1 day ago

you are given a list of N unique positive numbers ranging from 0 to N-1 . write an algorithm to replace the value of each number with its corresponding value inthe list​

Answers

Answered by yassersayeed
22

Answer:  

Input The first line of the input consists of an integer size,

representing the size of the list (N).

The next line consists of N space-separated integers,

arr[0], an[1].... arr[N-1) representing the given list of numbers.

Output Print N space-separated integers representing the list obtained by replacing the values of the numbers with their corresponding index values in the list.

Constraints 0< sizes 105 0 s arril s 105 0<i< size Note All the numbers in the list are unique.

Example numbers with their corresponding in the list Constraints 0.<sizes 105 Os artos 10 Osi< size Note All the numbers in the list are unique Example Input 4 3 201 Output 2310 Explanation Before the change,

the elements of the list are: arr(0)=3, arr[1]=2, ar (2)=0 and arr[3]=1 After the change,

the elements of the list are: arr(0)=2, arr[1]=3, arr(2)-1 and arr[3] =0

Similar questions