2108. Find First Palindromic String in the Array

Updated: 2024-02-24
1 min read
[]

On This Page

LeetCode problem 2108

class Solution:
    def firstPalindrome(self, words: List[str]) -> str:
        return next((w for w in words if w == w[::-1]), "")