About 957,000 results
Open links in new tab
  1. Longest Palindromic Substring - GeeksforGeeks

    Mar 10, 2025 · Given a string s, the task is to find the longest substring which is a palindrome. If there are multiple answers, then return the first appearing substring. Examples: Explanation: …

  2. Longest Palindromic Substring using hashing in O(nlogn)

    Dec 26, 2023 · Given a string S, The task is to find the longest substring which is a palindrome using hashing in O (N log N) time. The hashing approach to solving the longest palindromic …

  3. Longest Palindromic Substring using Dynamic Programming

    Mar 7, 2025 · # Function to find the longest palindrome substring def longestPalindrome (s): n = len (s) dp = [[False] * n for _ in range (n)] start, maxLen = 0, 1 # All substrings of length 1 are …

  4. Longest Palindromic Substring in Python - Online Tutorials Library

    Learn how to find the longest palindromic substring in Python with detailed explanations and examples.

  5. Find Longest Palindrome in a Python String (Easy)

    Sep 14, 2022 · The brute-force approach to finding the longest palindrome in a string is to iterate over all substrings in a nested for loop. Then check each substring if it is a palindrome using …

  6. algorithm - Write a function that returns the longest palindrome in a ...

    Jul 12, 2009 · static string GetPolyndrom(string str) { string Longest = ""; for (int i = 0; i < str.Length; i++) { if ((str.Length - 1 - i) < Longest.Length) { break; } for (int j = str.Length - 1; j > …

  7. python - longest palindromic substring solution - Stack Overflow

    May 31, 2022 · def longestPalindrome(self, s: str) -> str: if len(s) <= 1: return s. i, l = 0, 0. for j in range(len(s)): if s[j-l: j+1] == s[j-l: j+1][::-1]: i, l = j-l, l+1. # print(s[i: i+l]) . elif j-l > 0 and s[j-l-1: …

  8. Longest Palindromic Substring - LeetCode

    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: …

  9. Longest Palindromic Substring - devscall.com

    Jul 20, 2024 · Solve the Longest Palindromic Substring problem in Python. Learn step-by-step code examples to find the longest palindrome within a string using Python.

  10. 5. Longest Palindromic Substring - In-Depth Explanation

    For every substring length (from 2 to n), we set dp[i][j] to true if the corresponding substring is a palindrome. Here's the process: For substrings of length 1, each is trivially a palindrome. For …

Refresh