Longest Palindromic Substring - LeetCode 5 - Blind 75 - Coding Interview

preview_player
Показать описание

----- ------
The problem statement is as follows:
Given a string 's', return the longest palindromic substring in 's'.
A string is a palindrome if it reads the same backward as forward, and a substring is a contiguous non-empty sequence of characters within a string.

To solve this problem, we will use a technique called Expand Around the Center.

This technique is based on the idea that a palindrome has mirror image in the middle or in simple terms it can be read the same forward and backward so its like a mirror.

Next, we present the solution and walk you through the code step by step, highlighting the key points and explaining the logic behind each part of the solution.

Whether you are preparing for a technical interview or just looking to improve your coding skills, this video is a great resource.

If you found this video helpful, like, subscribe, comment.

#codinginterviewquestions #leetcode #leetcodesolution #leetcodedailychallenge #leetcodequestionandanswers

---- ----

Understanding The Problem : (0:00)
Brute Force Approach : (0:50)
Expanding Around The Center Technique : (1:14)
Complexity Analysis : (5:30)
Code Explanation : (5:56)
Рекомендации по теме
Комментарии
Автор

Thank You Bro..
Been struggling to solve this efficiently.. This is a great solution.

JassCodes
Автор

Nice solution, but isn't the Manacher's algorithm the optimal solution as its O(n) time complexity?

mrrrokas
Автор

This is cool! But how do you find these solutions? Do you learn the solution or do you learn some principles? Thanks.

nikvacuol
Автор

nice explaination. what software do you use for animation?

sinnyeet
Автор

Faced strange error, running it on Leetcode, cant fix it
TypeError: takes 3 positional arguments but 4 were given
oddPalindrome = self.expandAroundTheCenter(s, i-1, i+1)

fkwoysb