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.
@lornamuchangi12232 жыл бұрын
We are checking from center ever possible palindrome.
@paulgz101 Жыл бұрын
Best explanation of this problem. Thanks!
@ishaan3803 жыл бұрын
After watching couple of videos I can surely say this is the shortest and best video for this problems solution in O(n^2)
@StaceyWilsonlosangeles3 жыл бұрын
Okay, I would say that your explanation is great. Very intuit thought process for handling even and odd palindromic strings. Great Job!
@linlinli24403 жыл бұрын
I really like your explaination!! so simple and easy to understand! thank you!! please keep updated!!!
@harshnamdeo613 Жыл бұрын
thanks for this video!!! i was going through the same approach but wasn't able to find my error !!!! thanks buddy....
@mohammedfaseeullah6095 Жыл бұрын
Hi , why i-- is used at last , could you explain 6:57
@trytocreatesomethingnew8564 Жыл бұрын
I'm also confused in that line
@santiderek2 жыл бұрын
why did you do i-- outside the while loop? can you explain that part please
@christianhurtadocatacoli1757 Жыл бұрын
I think this has to do with the i representing the current pointers. She’s adding it ahead of time, instead of peaking so to speak. For example “abcbd” The function checks if c === c (so she adds 1), Now she checks if b === b (so i becomes 2), Then we check a === d which violates the palindrome and therefore the length we’re at is incorrect and reverts back to the most recent acceptable palindrome length, 1 giving us the slice “bcb”
@mosoakinyemi Жыл бұрын
@@christianhurtadocatacoli1757 Thanks for this breakdown!
@akshaynair37874 жыл бұрын
Thank you, the approach is really good
@rusiruabeywickrama2 жыл бұрын
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.
@4maxlol2 жыл бұрын
Yes.
@TechAndTravel-ny8tx2 жыл бұрын
Cheers!
@rajansidhu59122 жыл бұрын
Amazing explanation. Thanks for the video :)
@DanOhCaptainDaniel3 жыл бұрын
for some reason didn't pass for me, medium , explore page
@PlumsYT2 жыл бұрын
something about this just makes me feel like a hotdog without a bun
@gulinatayier90493 жыл бұрын
Great explaination! Thank you!
@PavanKumar-mr9td3 жыл бұрын
Awesome explanation super................
@carlosvenegas89813 жыл бұрын
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.
@darshitgajjar519910 ай бұрын
more video like this
@betheleyo27013 жыл бұрын
Great stuff. Thanks
@mrnabby41782 жыл бұрын
could you please make another video about palindromic substrings plz?
@fernandotoledo80932 жыл бұрын
from input "aaabb" I'm expecting this result: "ababa"; how do you pass this test case?
@tornike90182 жыл бұрын
thank you very much,works properly
@mohitnegi724 Жыл бұрын
Thanks
@felipemelendez57413 жыл бұрын
Thank you!
@datjoe6273 Жыл бұрын
I'm seeing this fail with 'abb' on LC. Returns 'b' instead of 'bb.' It works with the example test cases.
@markmathis39544 жыл бұрын
why did you add the `i--`
@vsworx4 жыл бұрын
I had the same question. Did you ever find out why the i-- is there.
@akshaynair37874 жыл бұрын
@@vsworx coz the I will go and stop at place where the string are not palindrome, right? But u don't want that, so i-- decrease one string where it was palindrome previous and return the value
@muazothman74163 жыл бұрын
@@akshaynair3787 yes you are right: if i is not decremented then it would be incremented and then it would break out of the while loop. So you want to decrement it to when the last iteration was true inside the while loop -- get it?
@fixcodedesign21652 жыл бұрын
please try this input "cbbd"
@thegeeksides3 жыл бұрын
This wouldnt pass the test case: ac
@alirezafirouzyar94254 жыл бұрын
this code will not pass other Testcase
@vsworx4 жыл бұрын
Interesting, what other testcases are you referring to?