DEV Community 👩‍💻👨‍💻

Abubakar Sadiq Ismail
Abubakar Sadiq Ismail

Posted on

Day 3 I4G 10 days of code challenge

Early in the morning after I wake up, I decided to start with todays code challenge before anything else;

The problem was given an integer you return true when it's a palindrome, else return false.
Palindrome are numbers,phrase or strings that when reversed the result is the same number;
e.g 1221 is a palindrome and will return true. 1234 is not a palindrome and will return false.

The solution i think is to covert the integer to a string;
Reverse the string;
Convert the reversed string to an integer;
Compare the original integer and the reversed Integer,
If they are the same return true
Else return false

Time complexity
O(n)
Space complexity
O(n)
Leetcode problem
Link to Implementation

Latest comments (0)

Image description

Join the One Year Club

You can earn this badge by being a registered member of the DEV Community for at least one year. Create an account and get started today.