Friday, February 1, 2019

Mirror Image

  • Problem Description

    Puck, the trickster, has again started troubling people in your city. 

    The people have turned on to you for getting rid of Puck. Puck presents to you a number consisting of numbers from 0 to 9 characters. 

    He wants you to reverse it from the final answer such that the number becomes Mirror number. 

    A Mirror is a number which equals its reverse. The hope of people are on you so you have to solve the riddle.

    You have to tell if some number exists which you would reverse to convert the number into mirror
  • CODING ARENA
  • no=int(input())
    temp=no
    rev=0
    while no>0:
        rem=no%10
        rev=rev*10+rem
        no=no//10
    if(rev==temp):
        print("Mirror")
    else:
        print("No Mirror")

  • Test Case 1

    Input (stdin)
    2112
    
    
    Expected Output
    Mirror
  • Test Case 2

    Input (stdin)
    2001
    
    
    Expected Output
    No Mirror

No comments:

Post a Comment