727. Inverse of number
0
Medium
Take the following as input.
A number
Assume that for a number of n digits, the value of each digit is from 1 to n and is unique. E.g. 32145 is a valid input number.
Write a function that returns its inverse, where inverse is defined as follows
Inverse of 32145 is 12543. In 32145, “5” is at 1st place, therefore in 12543, “1” is at 5th place; in 32145, “4” is at 2nd place, therefore in 12543, “2” is at 4th place.
Print the value returned.
Input Format
Integer
Output Format
Integer
Example
Input
32145
Output
12543
Constraints
0 < N < 1000000000
Loading...
View Submissions
Console