Some error occured while loading page for you. Please try again.
Given a sequence of integers, where each element is distinct and satisfies . For each where , find any integer such that and print the value of on a new line.
For example, assume the sequence . Each value of between and , the length of the sequence, is analyzed as follows:
The values for are .
Complete the permutationEquation function in the editor below. It should return an array of integers that represent the values of .
permutationEquation has the following parameter(s):
The first line contains an integer , the number of elements in the sequence.
The second line contains space-separated integers where .
For each from to , print an integer denoting any valid satisfying the equation on a new line.
Sample Input 0
2 3 1
Sample Output 0
Given the values of , , and , we calculate and print the following values for each from to :
Sample Input 1
4 3 5 1 2
Sample Output 1