IP #7 : Palindrome Number

   Palindrome Number  

by Ashur Baroutta

    Palindrome Number follows up on last week's work where we learned how to reverse an integer, which required a different sort of approach than the usual problem sets we've been working on. 

    A palindrome number is when the number reads the same way forward and backward, similar to the famous "racecar". So our problem statement simply asks us to return true if the number passed to us is a palindrome. 

    Given last week we learned how to reverse an integer, I thought it'd be useful to use the same type of approach. If I reverse half the integer and it's equal to the first half of the value passed, then they're the same forward and backward! 

    I used a basic while loop for when the value passed (x) is greater than the variable we use as our reversed number store. The code for my submission is below. The ranking isn't spectacular but I'm still proud of my efforts and thought process. 




Comments

Popular posts from this blog

IP #6 : Reversing an Integer

IP#5 : LinkedList Removing Duplicates II