# #I4G10DaysOfCodeChallenge - Day  3

## Question
Attempting the LeetCode problem [9. Palindrome Number](https://leetcode.com/problems/palindrome-number) 

Given an integer x, return true if x is palindrome integer.   
An integer is a palindrome when it reads the same backward as forward.

Hopefully, this solution is as easy as the question looks...    
Right, let's get to it!

#### Step 1: Convert x from an integer to a list   
```python
class Solution:
    def isPalindrome(self, x: int) -> bool:
        #convert x to a string (ie., x: int ==> x: str)
        #convert x to a list (ie., x: str ==> x: list)
``` 
#### Step 2: Duplicate x into y and read it from right to left   
```python
        y = #current value of x
        reverse the direction of y #(ie., from L-R to R-L)
``` 
#### Step 3: Compare the two lists   
```python
        if #value of x and y are equal
                return True
        else:
                return False
``` 
#### Pro Tip: Check if x: int is negative
```python
        if #value of x is less than zero
                return False
```     
Since we know that a negative number cannot be a palindrome it's a good idea to check for that first. So, I'd advise that you keep this check at the very top of the program to save the time of running further checks.
#### Highlight of the entire process:
```python
class Solution:
    def isPalindrome(self, x: int) -> bool:
        if #value of x is less than zero
                return False
        #convert x to a string (ie., x: int ==> x: str)
        #convert x to a list (ie., x: str ==> x: list)
        y = #current value of x
        reverse the direction of y #(ie., from L-R to R-L)
        if #value of x and y are equal
                return True
        else:
                return False

        
``` 

Hope you find this helpful.


Happy coding!

Kindly follow me on [Twitter](https://www.twitter.com/boffinbee)  ||  [LinkedIn](https://www.linkedin.com/in/abolarinwa-quadri-8b16b5195)
