`{"id":"f96d4f60-1156-492e-90c4-b611ec21e6ee","name":"Inverse Of A Number","description":"1. You are given a number following certain constraints.\r\n2. The key constraint is if the number is 5 digits long, it'll contain all the digits from 1 to 5 without missing any and without repeating any. e.g. 23415 is a 5 digit long number containing all digits from 1 to 5 without missing and repeating any digit from 1 to 5.Take a look at few other valid numbers - 624135, 81456273 etc.Here are a few invalid numbers - 139, 7421357 etc.\r\n3. The inverse of a number is defined as the number created by interchanging the face value and index of digits of number.e.g. for 426135 (reading from right to left, 5 is in place 1, 3 is in place 2, 1 is in place 3, 6 is in place 4, 2 is in place 5 and 4 is in place 6), the inverse will be 416253 (reading from right to left, 3 is in place 1, 5 is in place 2,2 is in place 3, 6 is in place 4, 1 is in place 5 and 4 is in place 6) More examples - inverse of 2134 is 1243 and inverse of 24153 is 24153 \r\n4. Take as input number \"n\", assume that the number will follow constraints.\r\n5. Print it's inverse.","inputFormat":"\"n\" where n is any integer, following constraints defined above.","outputFormat":"\"i\", the inverted number","constraints":"1 &lt;= n &lt; 10^8, and follwing other constraints defined above.","sampleCode":{"cpp":{"code":"#include <iostream>\r\n#include <math.h>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n\r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) {\r\n // write your code here \r\n }\r\n}"},"python":{"code":"def inverse(n):\n # write your code here\n\ndef main():\n n = int(input())\n inverse(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"28346751","sampleOutput":"73425681","questionVideo":"https://www.youtube.com/embed/dbk42TKwk4M","hints":[],"associated":[{"id":"d6fe6ce7-aab6-412f-b9d0-bfc7cddacd73","name":"What is the time complexity of this code?","slug":"what-is-the-time-complexity-of-this-code","type":4},{"id":"db167877-84e2-43df-ae04-464ab0812c85","name":"To inverse a number we interchange the value of the digits with the index of the digits.","slug":"to-inverse-a-number-we-interchange-the-value-of-the-digits-with-the-index-of-the-digits","type":4},{"id":"dfb1c647-ccb1-46d6-96b8-6677bf151832","name":"Given here is an inverse of a number 34215. Find the original number.","slug":"given-here-is-an-inverse-of-a-number-34215-find-the-original-number","type":4},{"id":"fca5953d-f43d-494a-9907-743679ca8f73","name":"What will the inverse of 53142 be?","slug":"what-will-the-inverse-of-53142-be","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"c7a2482d-24ce-4d54-ac92-6fe986bbd3d5","name":"Inverse Of A Number","slug":"inverse-of-a-number","type":1}],"next":{"id":"4cab2495-4e65-44b3-a700-8a990704f4bb","name":"Inverse a Number","type":3,"slug":"inverse-a-number"},"prev":{"id":"63c89c25-699e-4c99-89cc-dff8b324a539","name":"Reverse a Number","type":3,"slug":"reverse-a-number"}}}`

# Inverse Of A Number

1. You are given a number following certain constraints. 2. The key constraint is if the number is 5 digits long, it'll contain all the digits from 1 to 5 without missing any and without repeating any. e.g. 23415 is a 5 digit long number containing all digits from 1 to 5 without missing and repeating any digit from 1 to 5.Take a look at few other valid numbers - 624135, 81456273 etc.Here are a few invalid numbers - 139, 7421357 etc. 3. The inverse of a number is defined as the number created by interchanging the face value and index of digits of number.e.g. for 426135 (reading from right to left, 5 is in place 1, 3 is in place 2, 1 is in place 3, 6 is in place 4, 2 is in place 5 and 4 is in place 6), the inverse will be 416253 (reading from right to left, 3 is in place 1, 5 is in place 2,2 is in place 3, 6 is in place 4, 1 is in place 5 and 4 is in place 6) More examples - inverse of 2134 is 1243 and inverse of 24153 is 24153 4. Take as input number "n", assume that the number will follow constraints. 5. Print it's inverse.

`{"id":"f96d4f60-1156-492e-90c4-b611ec21e6ee","name":"Inverse Of A Number","description":"1. You are given a number following certain constraints.\r\n2. The key constraint is if the number is 5 digits long, it'll contain all the digits from 1 to 5 without missing any and without repeating any. e.g. 23415 is a 5 digit long number containing all digits from 1 to 5 without missing and repeating any digit from 1 to 5.Take a look at few other valid numbers - 624135, 81456273 etc.Here are a few invalid numbers - 139, 7421357 etc.\r\n3. The inverse of a number is defined as the number created by interchanging the face value and index of digits of number.e.g. for 426135 (reading from right to left, 5 is in place 1, 3 is in place 2, 1 is in place 3, 6 is in place 4, 2 is in place 5 and 4 is in place 6), the inverse will be 416253 (reading from right to left, 3 is in place 1, 5 is in place 2,2 is in place 3, 6 is in place 4, 1 is in place 5 and 4 is in place 6) More examples - inverse of 2134 is 1243 and inverse of 24153 is 24153 \r\n4. Take as input number \"n\", assume that the number will follow constraints.\r\n5. Print it's inverse.","inputFormat":"\"n\" where n is any integer, following constraints defined above.","outputFormat":"\"i\", the inverted number","constraints":"1 &lt;= n &lt; 10^8, and follwing other constraints defined above.","sampleCode":{"cpp":{"code":"#include <iostream>\r\n#include <math.h>\r\nusing namespace std;\r\n\r\nint main(int argc, char **argv){\r\n int n;\r\n cin >> n;\r\n\r\n //write your code here\r\n \r\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) {\r\n // write your code here \r\n }\r\n}"},"python":{"code":"def inverse(n):\n # write your code here\n\ndef main():\n n = int(input())\n inverse(n)\n\nif __name__==\"__main__\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"28346751","sampleOutput":"73425681","questionVideo":"https://www.youtube.com/embed/dbk42TKwk4M","hints":[],"associated":[{"id":"d6fe6ce7-aab6-412f-b9d0-bfc7cddacd73","name":"What is the time complexity of this code?","slug":"what-is-the-time-complexity-of-this-code","type":4},{"id":"db167877-84e2-43df-ae04-464ab0812c85","name":"To inverse a number we interchange the value of the digits with the index of the digits.","slug":"to-inverse-a-number-we-interchange-the-value-of-the-digits-with-the-index-of-the-digits","type":4},{"id":"dfb1c647-ccb1-46d6-96b8-6677bf151832","name":"Given here is an inverse of a number 34215. Find the original number.","slug":"given-here-is-an-inverse-of-a-number-34215-find-the-original-number","type":4},{"id":"fca5953d-f43d-494a-9907-743679ca8f73","name":"What will the inverse of 53142 be?","slug":"what-will-the-inverse-of-53142-be","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"72157774-7fd0-4b8e-88dc-037800acd626","name":"Getting Started","slug":"getting-started-9996","type":0},{"id":"c7a2482d-24ce-4d54-ac92-6fe986bbd3d5","name":"Inverse Of A Number","slug":"inverse-of-a-number","type":1}],"next":{"id":"4cab2495-4e65-44b3-a700-8a990704f4bb","name":"Inverse a Number","type":3,"slug":"inverse-a-number"},"prev":{"id":"63c89c25-699e-4c99-89cc-dff8b324a539","name":"Reverse a Number","type":3,"slug":"reverse-a-number"}}}` Editor

# Inverse Of A Number

easy

1. You are given a number following certain constraints. 2. The key constraint is if the number is 5 digits long, it'll contain all the digits from 1 to 5 without missing any and without repeating any. e.g. 23415 is a 5 digit long number containing all digits from 1 to 5 without missing and repeating any digit from 1 to 5.Take a look at few other valid numbers - 624135, 81456273 etc.Here are a few invalid numbers - 139, 7421357 etc. 3. The inverse of a number is defined as the number created by interchanging the face value and index of digits of number.e.g. for 426135 (reading from right to left, 5 is in place 1, 3 is in place 2, 1 is in place 3, 6 is in place 4, 2 is in place 5 and 4 is in place 6), the inverse will be 416253 (reading from right to left, 3 is in place 1, 5 is in place 2,2 is in place 3, 6 is in place 4, 1 is in place 5 and 4 is in place 6) More examples - inverse of 2134 is 1243 and inverse of 24153 is 24153 4. Take as input number "n", assume that the number will follow constraints. 5. Print it's inverse.

## Constraints

1 <= n < 10^8, and follwing other constraints defined above.

## Format

### Input

"n" where n is any integer, following constraints defined above.

### Output

"i", the inverted number

## Example

Sample Input

`.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}28346751`

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}73425681`

Question Video

Discussions

Show Discussion

Related Resources 