Owen Abbott
1 min readDec 20, 2020

--

Well, it’s that time of week again, and I don’t know what to write. As usual. The whole point of this exercise is to position myself as an expert and I really don’t like doing that. I feel like there are enough conmen and impostors in the world.

I wrote a schedule of milestones to complete in my project a week ago, but didn’t adhere to it. Too much other stuff I have to do. Never was a person of leisure.

Today I’m doing another leetcode exercise I guess. The challenge is to check if an integer is a palindrome. Also, according to the examples, negatives can’t be palindromes. Because the minus sign counts as part of the number I guess.

So first, I have to check if the number is greater than zero. If it isn’t, I can return false. But if it is, I can convert it into a string.

if (x > 0){
const xString = x.toString()
}

Once it’s a string, I can split it into a list.

var isPalindrome = function(x) {
if (x > 0){
const xString = x.toString()
const xList = xString.split("")
}
};

Once it’s a list, I can start checking the proper indexes against each other. The last must be the same as the first, the last minus one must be the same as the second, etcetera.

I’m having some errors getting this to work and, frankly, I’m tired. Will update in a later blog. I hope you enjoyed learning how to do half of this simple problem.

--

--