Longest Palindromic Substring - LeetCode (Solution & Explanation | JavaScript)

preview_player
Показать описание
#longest #palindromic #substring #leetcode

Longest Palindromic Substring - LeetCode

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Topic(s): String, Dynamic Programming

Problem #: 5
Рекомендации по теме
Комментарии
Автор

Had a hard time understanding wrapping my head around the center expansion for odd/even numbered palindrome.
Shows again why visualization is so so so important. Thanks for the video! Subscribed.

snoudoubts
Автор

Best explanation of this problem. Thanks!

paulgz
Автор

Okay, I would say that your explanation is great. Very intuit thought process for handling even and odd palindromic strings. Great Job!

StaceyWilsonlosangeles
Автор

After watching couple of videos I can surely say this is the shortest and best video for this problems solution in O(n^2)

ishaan
Автор

I really like your explaination!! so simple and easy to understand! thank you!! please keep updated!!!

linlinli
Автор

thanks for this video!!! i was going through the same approach but wasn't able to find my error !!!! thanks buddy....

harshnamdeo
Автор

The space complexity for this solution is not O(1). It is actually O(n), Due to the fact that we slice the string and take the substring that substring length depend on the size of the string passed to the function. In the worse case there can be a string in which the full length of passed string can be a palindrome in that case the when we splice the main string into substring the code will actually perform a function that depend on the be n number of size where n is the length of passed string.

rusiruabeywickrama
Автор

Thank you, the approach is really good

akshaynair
Автор

something about this just makes me feel like a hotdog without a bun

PlumsYT
Автор

why did you do i-- outside the while loop? can you explain that part please

santiderek
Автор

Amazing explanation. Thanks for the video :)

rajansidhu
Автор

Hi, why i-- is used at last, could you explain 6:57

mohammedfaseeullah
Автор

for some reason didn't pass for me, medium, explore page

DanOhCaptainDaniel
Автор

good solution! I had a hard time understanding what was happening, so i followed the code step by step in debugger to understand how it solved the problem, then the solution made sense for me. Unfortunately for me her explanation didn't make sense to me.

carlosvenegas
Автор

could you please make another video about palindromic substrings plz?

mrnabby
Автор

I'm seeing this fail with 'abb' on LC. Returns 'b' instead of 'bb.' It works with the example test cases.

datjoe
Автор

please try this input "cbbd"

fixcodedesign
Автор

from input "aaabb" I'm expecting this result: "ababa"; how do you pass this test case?

fernandotoledo
Автор

this code will not pass other Testcase

alirezafirouzyar
Автор

The solution doesn't cover all cases.

rubytyt