Leetcode 2108: Find First Palindromic String in the Array

Pierre-Marie Poitevin
1 min readJan 13, 2022

In this problem, we want to find the first String that is a palindrome in an array of Strings.

Given an array of strings words, return the first palindromic string in the array. If there is no such string, return an empty string "".

A string is palindromic if it reads the same forward and backward.

No particular difficulty on the algorithm side here, we go through the array, and when we find a string that is a palindrome, we return it. At the end, if we didn’t find such string, we…

--

--