Longest Palindromic Substring O(N) Manacher's Algorithm
HTML-код
- Опубликовано: 9 фев 2025
- Problem:-
Given a string s, find out the longest palindromic substring in O(N)
using Manacher's algorithm.
This video explains the Manacher's Algorithm for finding out the longest Palindromic Substring.
Useful References:-
en.wikipedia.o...
articles.leetco...
tarokuriyama.co...
Website: www.ideserve.co.in
Facebook: / ideserve.co.in
8 years old but still better explanation compared to newer videos explaining the same
Thank you :)
Save time: I watched all of Manacher`s algorithms on youtube, this is the best one.
Thanks Ece!
epic explanation man. watching it twice did it for me. i can imagine the patience it took you to make these 176 slides
+ashish paralkar Thanks a lot for your kind feedback and you are right in that it took some patience to create this video. Ashish, we would really appreciate if you can spread the word about IDeserve(www.ideserve.co.in) in your peer circles.
Cheers,
Team IDeserve
@@IDeserve Thanks for making these slides and video! How long did it take you to make these slides?
Bro mai ni samajh paya
GFG took 4 articles to explain this. This man nailed it in only 15 mins .
Thanks Ritik!
This is really true.... :)
23 min lie h bhai acche se dekh
Took me over a week to finally understand all of this. This is one of the hardest algorithms out there. Outstanding work!
Thanks 😊
thank you ! Great job !@@IDeserve
I have honestly never encountered an O(n) algorithm that is tricker than this. You give the best explanation though, thank you.
Thank you so much for your kind words Jon!
Ukkonen's suffix tree construction would do if you want to see that. 😄
@@Adityarm.08 That algorithm is an atrocity. I was only able to code 80% of it and cannot understand the online solutions :/
@@mohammadanasmudassir9443 you need test cases, very thorough ones. I was also stuck at that point where you are - I think. that 1 famous Stack overflow post has a full chain of comments all of which taken together paint the full picture.
Ukkonen is a nightmare
Dude. This was hands down the BEST explanation for the algorithm I've ever heard. Thank you so much!
Thanks Daniel!
Quite brilliant. I went through 3-4 videos and 4-5 wiki/tutorials before this and I was extremely frustrated.
Finally my friend recommended your video and it is easily the best. Thanks a ton for putting in the effort to make this video.
Took me two passes to fully understand the code walkthrough but you've done a great job.
Thank for your nice words Kayysean99!
IDeserve, you definitely deserve a standing ovation! I can't wait to checkout your other videos. Thank you!
Thanks bro!
Epic video on Manacher's algorithm . Very clear and precise explaination. Appreciate the effort you have put to create this content.
Thanks Zeeshan!
Best explanation on Manacher's alg I've ever seen! Really appreciate you for sharing this!
Thanks Ziyan!
This is best lecture, I have found on RUclips to understand the Manacher's Algorithm. The way you teach It reflect how much deep understanding You have. Thank You for this wonderful explanation, It saves lot of time and effort.
Thank You! 😊
I agree with you. When I started thinking about revising this algorithm, I came here.
Was really struggling to the point I was gonna skip this algorithm. You helped me understand it, thank you so much for your help! This is way better than some videos with more views.
Thanks for the comment Shivansh :)
So far, the best video for understanding it, rather than just explaining the process
Thank you so much Doug for your kind words :)
great explanation, finally understood the enigma of Manacher's algorithm. keep doing the cool work
Thanks Imran!
After spending 1.5 days on this problem, and reading that 4 pg GFG article, thank God I found the link of this video in the discuss section of GFG. This is the Best Explanation till now of Manacher's Algo. Thank You @IDeserve for this wonderful explanation :)
Thanks Abhrajyoti!
This was pretty difficult to understand but your efforts are commendable. Thank you
I was struggling the whole day to understand this topic and now finally I saw this video. I feel relieved now , very well explained along with the code.
Thanks a lot for your words Shefali :)
We are striving hard to make understanding algorithms easier.
We would really appreciate if you could spread the word about IDeserve in your college and to your colleagues.
Also please check out our website at: www.ideserve.co.in
It has features like Algorithm Visualization, Learn Together and many more coming soon.
Please check it out and leave us a comment there!
Thanks,
-Team IDeserve.
been trying to understand it for hours and I understood it perfectly in a 15 minute video. thank you so much!
Thanks :)
Seriously, the best explaination I could get on whole youtube.
Thanks :)
Thanks Prabhav!
I didn't think I fully got it when I finished the video, but then I tried to code it without referencing back here and it worked. Thanks!
the best and most clear explanation of manacher on YT
Thank you :)
Nice explanation... I watch the video a couple of times, but I understood it perfectly. Thanks man for sharing this.
Thanks Kshitij for kind words!
I don't think this could've been explained any better than this. Appreciate your efforts, sir.
Keep up the good work.
Thanks
Thanks Shubham!
I've watched around 5 videos and read 6 articles on this topic, and this video is the best and lucid explanation of the topic. Thankyou!
Thanks Tushar! 😊
couldn't get anything from the explanation alone, but as soon as you started showing the code, everything you explained started to click into place, very much well done
gone through many videos of manacher's algorithm.But this is the one where my searching stopped.Thank you for this awesome content
Thanks Priyanshu!
wow man the amount of effort you took to explain in this video is incredible, take a bow sir
Thanks Arnab ☺️
Thanks, the best walk-through of the algorithm I've seen so far!!
Why'd you guys stop making videos?
I was struggling yesterday night switching from video to video, at first, I didn't understand your explanation, but now it's clear. Thank you very much.
Thanks for your kind words :)
We would really appreciate if you could spread the word about IDeserve in your college and to your colleagues.
Also please check out our website at: www.ideserve.co.in
It has features like Algorithm Visualization, Learn Together and many more coming soon.
Please check it out and leave us a comment there!
Thanks,
-Team IDeserve.
Your explanation is Amazzing, simple and easy to understand, probably the best for such a complex algorithm. please keep it up. Thanks for this video and thanks to Mr Manacher as well for this algorithm.
Thanks Sudipta!
Thanks man. I struggle for whole day to understand it, but you made it so easy. Really appreciate your effort.
Thanks Ankish!
I don’t give up often but when I do it’s Manacher’s algorithm 😂
🙈
+1 😒
best explanation found till now !!
Excellent and very detailed presentation of a very complex topic. A lot of work must have gone into the graphics.
Thanks Kunal!
The "thinking pause" did it for me. I am floored
Hey, I love these videos. These are definitely helping me as I prepare for the interview for my internships.
+Wenhao Du
Thanks a lot for your words! It is very encouraging to hear such comments!
Also please check out our website at: www.ideserve.co.in
It has features like algorithm visualizations, learn together and many more coming soon.
Please check it out and leave us a comment there!
Thanks,
-Team IDeserve.
I've seen many top youtuber's tried to explain but only you succeeded.
A really good explanation. Thanks for your hardwork man.
Thanks Aatish!
@@IDeserve Is the video on explaining the time complexity of this algorithm uploaded ?
went through a lot of videos to understand this algorithm. But this one is the best so far.
I had decided to skip manachers algo for upcoming placement! Now I have it in my toolkit! thanks man
gr8 job!
All the best for the placements!
You are so good that you could have come up with this algorithm on your own. Thanks!
Thanks Nisheet for your kind words!
I watch it again after almost 2 years, I have to say this video is by far the BEST algorithm on youtube ever!!!
Hey James, welcome back!
Extra ordinary explanation of the mental modal behind Manacher's algorithm. The best of the best.
Thanks Akila!
What an explanation sir. Keep it up. The best thing was you dry ran the code also with values, i didn't require even a pen and a copy to understand.
Thank you so much for your kind words Sitesh!
Superb explanation. I was able to follow through without any trouble. Hats off. Would be great if you could explain KMP algo and Z algo as well. Thanks for this one.
Thanks Shubham!
Best Manacher's Algorithm explanation I have ever seen.
Thanks!
Great Explanation. Probably the best i have come across so far.
thank you so much, sir, you are great ......
I found a lot of videos on manchester's algo but all that was waste material.
you are a gem in terms of algorithms.
Thanks Ashutosh!
This was so helpful thank you! I appreciate all of the patience it took you to iterate through this.
Thank you so much for your kind words Glory!
Thanks for the extremely clear explanation! Tracing the code made it even better :)
You are welcome Tyler!
Bro you saved my day with your wonderful explanation, definitely subscribing!
Awesome explanation, loved your work and effort. You actually deserve it!!
Thanks Savan!
I have watched other videos also. But your one made me understand it completely. Kudos to you buddy. Keep going.
Thanks Ashwani!
Excellent explanation for a complex algorithm. Minor correction of logic:
If condition after 'while' loop is going to run every 'i' values that are greater than R.
Example: 'ABABABACDEFG' try this as an example and check C and R values would change for i > 15 and overwrite C and R values to lower values. This will result in a wrong output.
So, this 'if' condition should check for P[i] should be greater than P[R] to change C and R to new values.
Replace
if(i + P[i] > R)
with
if(P[i] > P[R])
Thank you for the great explanation.
Such a easy explanation, thank you sir
Thanks Prateek!
I looked at some other explanations and yours is by far the best. Thank you so much!
Thank you so much for your kind words Dario!
after rewinding and pausing crying finally it just clicked dont give up on this it is staple for palindromic problems
Awesome explanation. Thank you very much. Appreciate your efforts.
Thanks Prashant!
Great video. I have read some blogs about this Algorithm and still not understand.
Withi your explaination, it become clear to me! Thanks very much!
+Owen Xu
Thanks a lot for your words! We are striving hard to make understanding algorithms easier.
We would really appreciate if you could spread the word about IDeserve in your college and to your colleagues.
Also please check out our website at: www.ideserve.co.in
It has features like algorithm visualizations, learn together and many more coming soon.
Please check it out and leave us a comment there!
Thanks,
-Team IDeserve.
very clear explanation. Great work. Thank you!
Thanks Puneet!
23:48 minutes used for the best man !! Thank you so much for this finally got this😂
You are welcome!
Thank you sir! It's a really helpful video!
Thanks Miguel! 😊
Thank you a lot for your explanation! It is the video that is worthy to spend 24 minutes on it!
Thank you so much for your kind words Daniel!
Really great explanation. Watched couple of videos for this algo and yours is the best one. Very precise and your code walkthrough was awesome which made it complete. Appreciate your efforts in making those slides.
Your videos would be mine first goto from now.
Happy to share!
Thank you so much for your kind words Harmeet!
+Andrea De Domenico
Thanks a lot for appreciating! There are many more videos coming soon. Also, you can let us know any interview topic or question of your choice that you would like to see on IDeserve.
Thanks,
-Team IDeserve.
I would recommend most of the difficult and medium level questions from leetcode and their principles.
Wonderful explanation, concise and apt :)
Helped me understand it till the depth. Great work, kudos !
Thanks Shaival for your kind words :)
you definitely deserve a subscription man.
Thank you so much for your kind words Ram!
Actually I was going to leave this algorithm after seeing Tushar Roy's video knowing how complex this is but after seeing yours the rest is history. Just make stuff like this and make RUclips a better place to learn✌️
Thank you so much Ram!
I have been trying to understand this algorithm, but failing .. thanks ..just a single watch here on ur channel, I have understood it completely
Great Explanation, no other video on YT does the explanation this way, I was looking for video like this. Eg: "what is making the brute force algorithm to run in O(n^2) and how it can be optimized"
Thanks Teja!
Awesome!
This is the most intuitive explanation, even people dull like me can understand the point of this algorithm now!
Nice job, looking forward more of your publish!
+吴佩 It's really encouraging to hear comments like these. Yes we are uploading new videos on regular basis. So, stay tuned :-).
Please feel free to let us know if you would like us to upload a video for a particular topic/algorithm. We will really appreciate if you can spread the word about IDeserve(www.ideserve.co.in) in your peer circles.
Thank you,
Team IDeserve
Best explanation On the INTERNET.
Thanks Saurabh!
the best explanation of manacher's algorithm, great buddy it really hepled me alot
Thanks Mihir!
This is awesome explanation , the visualisation helps a lot with understanding the idea behind the algorithm! Great job guys.
Thanks Li!
Dear Friends,
If you like our content and would like us to continue making great content for you, please spread the word about IDeserve.
A share/appreciation from you on social network would mean the world to us!
Also, do like our Facebook page: facebook.com/IDeserve.co.in :)
Thanks,
-Team IDeserve.
Sir you nailed it . Thank you so much for awesome explanation 🙂
Thank you for your kind words! 😊
This is an excellent video. Just one suggestion for future videos: in the example that you went over, we never had the case where we had to take R-i over P[mirr]. It would be good for the example to include this case.
excellent explanation bro. your patience must be paid off. keep up good work...
Thanks Adarsh!
Awesome work man. Best explanation ever i have found on online.
Thank you so much for your kind words Tanmoy 😀
you have done a good job debugging the code. keep it up bro.
Thank you so much Sayed for your kind words :)
thanks man. explanation is so good!!
Thanks Glenn!
It's actually quite a simple algorithm once we become familiar with the concept. Basically, copying over the mirrors expansion length if the index lies within the current right boundary means we don't calculate the expand length from scratch at every index - we use the symmetric property of palindromes to give us a O(n) time.
Spent whole day to understand this from other resources result ==> ~NULL
Spent time here understood in 2 go !!
Recommended!!
Thank you for the best explanation.
Thanks Ayush for your kind words!
Watched more than 10 videos before this to get this algo tns bro❤
Thanks Raju!
Thanks man!! You are a good teacher. I got the central idea after watching your video once. Now, I can try coding it on my own.
Thank you so much for your kind words Prudvinath!
To those who have unliked this videos, "Are u people even humans?"
Thank you so much for your kind words 😊
Nice explanation sir, other youtubers video are little difficult to understand on this topic.
These repetitive comments on how brilliant this video was tells us about this video...from my side I really appreciate your efforts :)
Thanks Anirudh!
best video to understand Manacher's Algorithm.👍👍
Thank you!!
Great work. Best explanation I've seen yet.
+Jacob Hubbard Thanks a lot for your words! It is very encouraging to hear such comments! We are striving hard to make understanding algorithms easier.
Please check out our website at: www.ideserve.co.in. It has features like algorithm visualizations, learning together and many more coming soon!
Very good explanation Thanks you very much!
Thanks Rejeti!
youtube recommended this, glad it did
Thanks!
Great explanation. I feel if there were indices on P[ ] then it would be easier to follow when you went through the code.
Thank you so much! There may be more viewers if you add "5. Longest Palindromic Substring" in your title!
Thank You!
Appreciate the effort. One of the best coding channels!
Thanks Joydeep!
The explanation is really good and simple. But, where is the complexity video?
Hey Mohammed Elrashidy,
If you would like to request a new video, here is the process: ruclips.net/video/3fQLOfuMfl0/видео.html
Thanks,
-Team IDeserve.
Absolutely amazing explanation, thank you so much!
Thanks Aries!
Superb explanation...!!!! finally understood algo..!!!
Thanks you for your kind words Sachin!
Great job!!...Looking forward for more videos
Thanks for your kind words Ipsha!
Great Effort ... Truly Grateful sir
Thanks Samadeep!