What is the measning of this question?

what is the measning of this question???

In this question you have to find and print the smallest number possible by reversing digits of the input.

  • As x <= 100000000000000000, use long long int datatype or for this specific question, you can use a string also as it is easier to iterate on digit of the number.

  • Now starting from the leftmost digit in the number iterate till the rightmost digit, do the following:
    2.1. find the invert of the current digit s[i] i.e. 9-s[i]
    2.2. check if the invert is smaller than the actual digit:
    …if yes, then replace the digits[i] in the number with it’s invert.
    …if no, then don’t replace
    example 1:
    123
    inverting 1: 9-1=8
    as 8>1,
    so, if i would replace 1 with 8 (i,e 823), then the number will become larger.
    But, we are required to find the smallest, so don’t replace.
    example 2:
    632
    inverting 6: 9-6=3
    as 3<6,
    so, if i would replace 6 with 3 (i,e 332), then the number will become smaller.
    Thus, replace will be made.

  • As it is mentioned that the leftmost digit can’t be 0, so we would not replace if a[0]=9
    example:
    912
    inverting 9: 9-9=0
    0<9,
    But, the number cannot start with 0.
    So, we won’t replace.

Hope, this would help.

what does revert means and 9-n

You have to invert the digits in order to form the minimum possible number. Inverting a digit here means replacing that digit with (9-original digit)