Palindrome Number (Python) – Leetcode #9



Palindrome Number (Python) – Leetcode #9

Palindrome Number (Python) - Leetcode #9

Given an integer x, return true if x is a palindrome and false otherwise. This is the 9th problem (easy mode) on leetcode, and I will show you the solutions in Python. A palindrome is a sequence that when reversed, it is identical to the original sequence. So, a palindrome number is a number that when you reverse it, it is the same as the original. For example, 121 is a palindrome number, but 123 is not. That’s because the reverse of 123 is 321, which are not identical to each other. In this video, I show you two different solutions to solve this problem. One solution is to convert is to strings and reverse the string, then check with the original. The second solution is to use arithmetic operations. This means the solution will use only numbers and operations such as plus, minus, multiply, divide, etc to verify if a number is a palindrome or not. I can tell you that negative numbers are not a palindrome because of the negative sign.

If you enjoy this video, please subscribe and share with others!