LeetCode Problems

Reid Jackson
2 min readMar 4, 2022


Staying sharp means consistent practice. There are so many facets of technology that could occupy my attention, but I feel that it is important to always sharpen the tool that is programming. Solving programming puzzles is a matter of keeping logical reasoning skills strong, and it’s also a lot of fun. The most recent problem that I have been working on is fairly simple, but I decided to write in javascipt for the first time in a while.

Months ago, I chose to learn python and I have a great foundation in that language. Python modules are easy to implement and it’s so much simpler to get started, but I wanted to shake off the JavaScript dust and make sure that I still had the chops to handle challenges in JS. The problem on hand was from LeetCode and is as follows:


My solution involves using regular expressions and looping over each string. I apply a filter that only allows letter characters to be evaluated. Each character is pushed into two arrays. Each array is built from the first letter up or backwards from the last letter forward. Afterwards, I compare each array (as a string) and if both strings are identical, then the argument is a palindrome (return true).

Here’s a peek at my solution:

Regular expressions shorten a lot of English language problems into one-liners that confuse the naked eye, but I enjoy writing them and the time that RegExs save are well worth the time. If you’re just wrapping your head around regular expressions, check out rubular. This website offers an unlimited sandbox testing environment for anyone dipping their toe in regular expressions.