LeetCode Tutorial 5. Longest Palindromic Substring

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

LeetCode Tutorial by GoodTecher. The tutorial provides a step-by-step demonstration on how to solve coding problems.

Complete Playlist for the GoodTecher LeetCode Tutorial:

GoodTecher Website:

GoodTecher Channel on YouTube:

GoodTecher Github:

GoodTecher Facebook

GoodTecher Twitter
Рекомендации по теме
Комментарии
Автор

Surprisingly out of all tutorials on youtube, yours made the most sense. It's also important to note that you kept track of left and right variables rather than keeping track of and updating a longest substring each iteration which takes O(n) time and space alone.Thanks!

FilmerWilliam
Автор

Was confused about the (j-i) <= 2 as well. If someone's still confused, here's a simple explanation:


1 ) When (j - i) == 2 : The characters at 'i' and 'j' have exactly one character between them. One character is obviously a palindrome.
2) When (j - i) == 1: (This one was confusing at first). We just set isInnerWordPallindrome = True since an empty string is a valid inner palindrome(well..). In the if condition on the next line, we would anyway check characters at 'i' and 'j'. If these match, the condition becomes true because isInnerWordPallindrome is true.


Hope this trainwreck of an explanation helps.

MoonStruckHorrorsX
Автор

Please keep up the good work. Your channel is by far the best leetCode explaination channel I have ever seen on youtube! Your code is both efficient and easy to understand. Thank you GoodTecher.

Chino
Автор

Thanks a lot man. All these big channels couldn't explain it this well. Good job!

yeeteshpulstya
Автор

Best explanation of the dp approach that I’ve seen so far on YouTube! Thanks

imswtj
Автор

A good teacher indeed. Thank you for sharing. Easy to follow.

xl
Автор

This video really is one of the best ones on dp approach!

panzabamboo
Автор

AMAZING TEACHER..LANGUAGE IS NOT A BARRIER TO UNDERSTAND A PICTURE!!

kayalvizhi
Автор

Great tutorial, this made things clear. Thanks for posting it!

callrakkha
Автор

This is such an amazing approach, Thank you so much.

ANUJSHARMA-ollw
Автор

This is a brilliant approach for this problem. Thanks. :)

MoonStruckHorrorsX
Автор

It is smart to do the loop vertically since we need to check the left below position. I cannot pass all the test cases if I loop horizontally. Thanks for your videos.

haileyliu
Автор

Sir, very good video, but it doesn't work for string- "EABCB", expected in "BCB" but the output is "E", which is wromg, any idea?

krishika
Автор

best explanation ever man. thanks a lot!

reyou
Автор

I think you should check for null before finding the length of the string. If s is null the code will blow up with NullPointerException on line 3.

akaukuntla
Автор

keep up the good work! you are the best.thank you

hangyuli
Автор

thanks for sharing this video really helpful.. this explanation made me understand dynamic approach, one doubt about j - i <= 2

piyushsharma
Автор

Very good explaination !

doubt at last if(j-i > right-left){ --- }

swapnilkauthale
Автор

Really well explained. One error though. s == null should be done before using .length()

rohanarora
Автор

why is the inner loop starting from 0 and going only till j ? what about combinations that start from other indices ?

Dyslexic_Neuron