Leetcode 0125. Valid Palindrome

Posted on Mon 16 December 2024 in Leetcode • Tagged with palindrome

Question Link : https://leetcode.com/problems/valid-palindrome/

Difficulty: Easy

Premium: False

Question

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true …


Continue reading

Leetcode 0005. Longest Palindromic Substring

Posted on Mon 27 March 2023 in Leetcode • Tagged with palindrome

Question Link : https://leetcode.com/problems/longest-palindromic-substring/

Difficulty: Medium

Premium: False

Question

Given a string s, return the longest palindromic substring in s.   Example 1:

Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid answer.

Example 2:

Input: s = "cbbd" Output: "bb"

Constraints:

1 <= s.length <= 1000 s …


Continue reading

Leetcode 0009. Palindrome Number

Posted on Mon 27 March 2023 in Leetcode • Tagged with palindrome, math

Question Link : https://leetcode.com/problems/palindrome-number/

Difficulty: Easy

Premium: False

Question

Given an integer x, return true if x is a palindrome, and false otherwise.   Example 1:

Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left.

Example 2:

Input …


Continue reading

Leetcode 2131. Longest Palindrome by Concatenating Two Letter Words

Posted on Wed 02 November 2022 in Leetcode • Tagged with palindrome, string

Question Link : https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words/

Difficulty: Medium

Question

You are given an array of strings words. Each element of words consists of two lowercase English letters. Create the longest possible palindrome by selecting some elements from words and concatenating them in any order. Each element can be selected …


Continue reading

Leetcode 0647. Palindromic Substrings

Posted on Mon 23 May 2022 in Leetcode • Tagged with palindrome, string

Question Link : https://leetcode.com/problems/palindromic-substrings/

Difficulty: Medium

Question

Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring is a contiguous sequence of characters within the string.   Example 1:

Input: s …


Continue reading