HACK IT SOLUTIONS CODECHEF SSEC0005

HACK IT SOLUTION SSEC0005

An App needs a client to make solid passwords so secret word must be multiple digits and under 10 digits. I run a site which hacks a specific client’s ID in that application. So once you login to my entrance you will be furnished with a connect to login to the application and once a client clicks your connection to login to that app,you will see his secret key. 

Yet, I committed an error thus you can’t discover unique secret word in my entry . The gateway is indicating you by including two in each digit . So , presently you need to discover the first secret phrase of a client on the off chance that I give you the secret phrase which is appearing in your entry. 

 

Information

The primary line contains a solitary number t (1 ≤ t ≤ 1000) — the quantity of experiments. 

The main line of each experiment contains a solitary number n which is appearing in my entry . Psyche it , each digit of n is more prominent than one. 

 

Yield 

Print unique secret phrase of client . 

 

Test INPUT 

3527 

47269 

 

Test OUTPUT 

1305 

25047

DOWNLOAD THE SOLUTION

LOGIC IS IN COMMENT SECTION

6 thoughts on “HACK IT SOLUTIONS CODECHEF SSEC0005”

  1. Hey! Hope your doing great.

    Let me help you with this with a simple example, as per your question if n=222 then the answer is 000 it wont be single digit remember it's a password and if you read the question it says "password must be more than 3 digits and less than 10 digits".

    Example : if n=23242
    output will be: 01020 (As we can see we have to subtract 2 from each digit) now to that we can use various techniques but we will take the simple one here.

    You can extract last digit by using "%" now if your planning to go from beginning you can choose "/" I hope you know how to extract last digit of a number.

    Let see some more test cases

    n=3645
    op=1423

    n=2224222
    op=0002000

    So what will be the output for this test case n=034205? Lets us know.

    Soon we will share the algorithm. Keep Coding

    Reply
  2. Yes, I hope if others are seeing this comment it will help them out too.Glad that you solved it.

    Now if most of you are thinking how n=034205 is 012003.

    Once again I'll say read the question properly,

    "Mind it , every digit of n is greater than one"

    So there goes your answer,

    Let's see this
    n=040
    op=020

    Why? Because n>1 so we must take 0 as it is so we left only with 4 to deal with which we are going to subtract 2 from it so now its 2 , that why 020 will be the output.

    If you try anything is possible, you guys are smart and clever KEEP CODING.

    Reply
  3. Well if it can accept it why now if it can take string output instead of integer then this question is way more easy to do in python.

    How?
    You can take list as input as each index look for the value and minus it with 2 and then keep updating this in temp variable and print it out.

    This Logic will work only if its taking string as output.

    Reply

Leave a Comment