Longest palindromic substring | Dynamic programming

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 490

  • @techdose4u
    @techdose4u  Год назад +3

    🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037
    🔴 𝐂𝐡𝐞𝐜𝐤𝐨𝐮𝐭 𝐚𝐥𝐥 𝐨𝐮𝐫 𝐂𝐨𝐮𝐫𝐬𝐞𝐬: techdose.co.in/

  • @thecritiquer5976
    @thecritiquer5976 Год назад +14

    I knew from reading other explanations that it was the explanation itself that was hindering everyone including myself. You are so far the only person that actually explained how the dynamic approach works clearly.

  • @hey.............
    @hey............. 4 года назад +223

    Kudos for going through the whole input string instead of saying so on and so forth👍

    • @techdose4u
      @techdose4u  4 года назад +16

      😂

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

    • @tekbssync5727
      @tekbssync5727 3 года назад +23

      @@lionelmesssi2959 I don't think there will be any football match tomorrow .

    • @ganesh3761
      @ganesh3761 3 года назад

      @@tekbssync5727
      😅😁

  • @KushalBhatia
    @KushalBhatia 3 года назад +9

    Please give this man a medal.
    Thank you for going through the whole string dry run

  • @ragas_
    @ragas_ 4 года назад +495

    Fact : This guy alone is responsible for more placement offers than all college professors combined !
    Change my mind

    • @techdose4u
      @techdose4u  4 года назад +29

      Thanks

    • @ankitparashar8730
      @ankitparashar8730 3 года назад +20

      Professor kaha padhata
      Sab chutiyapa hai professor

    • @prajwalraut7480
      @prajwalraut7480 2 года назад

      woahhhh today also this one is best explaination!!!!!!!!!!!!!!

    • @KevinLin45
      @KevinLin45 Год назад

      🧠 yelo change krlo :)

  • @aslanfeng413
    @aslanfeng413 5 лет назад +82

    THE best explanation I’ve heard so far!!!

    • @techdose4u
      @techdose4u  5 лет назад +2

      :)

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад +1

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

  • @ayyappareddy4461
    @ayyappareddy4461 2 года назад +2

    I watched lot of videos for this problem but no one explained like the way you explained.thank you sir

  • @bookalicious9849
    @bookalicious9849 3 года назад +20

    Excellent explanation ! As a newbie in dp i really was struggling to understand this concept but you made my life easier !!!

  • @abdalla4425
    @abdalla4425 9 месяцев назад +1

    I really love how you draw and go through the DP table. I don't see many people explain it that way and it can be very hard to visual or trace through at first. Thanks So much!

  • @ZiadGholmish
    @ZiadGholmish 4 года назад +13

    Honestly, the best one explained this question

  • @sam_s3344
    @sam_s3344 4 года назад +7

    Thanks a million for making such an incredible explanation for a GFG code. Sometimes they have good codes, but no explanations or the explanations are not clear enough. This is just so well explained. All your videos are helping so many of us. Keep up the great work!

  • @utkarshsrivastava7885
    @utkarshsrivastava7885 4 года назад +15

    You are just explaining the whole concept with patience . thanku for clearing me this algo ,you are just my fav man❤️

  • @yuganderkrishansingh3733
    @yuganderkrishansingh3733 5 лет назад +123

    Bro this is the best explanation for the question and I finally understood it. Explaining is an art and making others understand is a superpower and you clearly has it. The video was crisp and so easy to follow. Just loved it.
    Pls keep making more videos. I know you might be busy with other stuff(I am sure u might be working for some top notch company and if not then you are surely going to be very soon) but pls keep making more videos.

  • @shrutibansal5261
    @shrutibansal5261 2 года назад +1

    best video I have seen so far for understanding dp using a table

  • @sathvikrijo
    @sathvikrijo 5 лет назад +36

    One of the best explanations for this question, for dp beginners🎉🍾 thanks a lot man💐👍

  • @sanikadeokule3545
    @sanikadeokule3545 24 дня назад

    I was struggling with this for quite some time. You taught it with so much patience. Hats off! Very grateful to you

  • @AbhishekA-81
    @AbhishekA-81 3 года назад +4

    One of the best teachers found on RUclips 👍🏻

  • @jrajesh11
    @jrajesh11 3 года назад +5

    What a great presentation and explanation ! You are just going frame by frame and bringing clarity all the way down deep! Keep doing such great videos for demystifying complex algos.

  • @paulcurran3661
    @paulcurran3661 4 года назад +7

    Thank you for this, I've had trouble understanding this algorithm in other videos but this is the best explanation I've seen.

  • @mychannelyashi2441
    @mychannelyashi2441 4 года назад +3

    This channel is now becoming my fav channel,,, thanks for explaining the concept so easily .

    • @techdose4u
      @techdose4u  4 года назад +1

      Welcome :)

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

  • @JSInstructor
    @JSInstructor 3 года назад +2

    Thank you so much for the video! I hadn't truly understood the dynamic programming approach to the max palindrome substring problem until I watched your explanation. Thanks again!

  • @9669sumit
    @9669sumit 2 года назад

    Now i know why your video is on the top when searched for this problem. Thanks for such good content.

  • @ahasunos5914
    @ahasunos5914 3 года назад +1

    He made this problem a cake walk. Thanks man.

  • @TravelWithAmitDubey
    @TravelWithAmitDubey 4 года назад +5

    I liked the way you explained this problem, best explanation I ever found for this problem.

  • @atefnazi753
    @atefnazi753 3 года назад +2

    How you explain these things so clearly..... I must say you are very underrated

  • @krithickkrishnagiri6371
    @krithickkrishnagiri6371 4 года назад +5

    finally got the concept behind the dynamic programming. Thank you

    • @techdose4u
      @techdose4u  4 года назад

      Welcome :)

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

  • @aadhyatiwari9688
    @aadhyatiwari9688 Год назад

    A really crisp and to the point explanation! Loved the video, thank you

  • @satvik_b
    @satvik_b 2 года назад +5

    good explanation! The reason this is a dp problem is that it has over lapping sub problems. For substring from index 1,5 we need to check if substr from index 2,4 is palindrome or not and for substr 0,6 we would not compute for substr 1,5. So it will take O(1) time instead of O(n).

  • @beautifultime9031
    @beautifultime9031 4 года назад +5

    The only video that explains the DP matrix and each step of the algorithm. Thanks so much.

    • @techdose4u
      @techdose4u  4 года назад +2

      Welcome :) I always explain the intuition and steps of dp matrix with reason for formulations.

  • @radhu8
    @radhu8 3 года назад +1

    Can't explain how thankful I am for your explanations!

    • @techdose4u
      @techdose4u  3 года назад

      Welcome :)

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

  • @kumarc4853
    @kumarc4853 3 года назад +2

    thank you Tech dose, I cracked google and linkedin. Learned a lot from your videos and explanations

    • @techdose4u
      @techdose4u  3 года назад +1

      Congratulations 🤗💥🎉

  • @mukeshbalaji04
    @mukeshbalaji04 3 года назад +1

    you have the best dynamic programming playlist ever

  • @manojrajasekar6035
    @manojrajasekar6035 5 лет назад +7

    Best Explanation ever ! Please continue doing this. Thank you :)

  • @AmazingWorld-fw9oc
    @AmazingWorld-fw9oc 4 года назад +3

    I'm glad I found this channel.

  • @anitapanda9267
    @anitapanda9267 3 года назад +2

    Sir...how beautifully u explained the logic...Thank you

  • @shubhammahindru3563
    @shubhammahindru3563 Год назад

    This is the best expalantion for this question on youtube, thanks mate

  • @tigerbear3038
    @tigerbear3038 3 года назад +1

    Excellent explanation! Really appreciate that you went step by step even though it seemed tedious but it made it easy to follow.

  • @meetmodi2487
    @meetmodi2487 4 года назад

    New to DP. Was trying to get this approach for 2 hrs.Thanks alot for the explanation.Explained so well,no need to upload the code!

  • @chillegaming8250
    @chillegaming8250 3 года назад +1

    This is gold! Thank you for that clear explanation.. your DP series is the best out there!

  • @Urvashi7ful
    @Urvashi7ful 11 дней назад

    I had to watch it twice, but this is such a good explanation!

  • @jhilikkundu3158
    @jhilikkundu3158 3 года назад +1

    Noone says that row is the starting pos and column ending. You just clear my doubt in first few minutes. Thank you again.

  • @arjunreddy3615
    @arjunreddy3615 4 года назад +2

    Explained very well.. I have written the code using the instructions and it is working well strings of random sizes.. Thank you...

  • @0laoye
    @0laoye Год назад

    what a great explanation! love your divide and conquer techniques

  • @harshitbhatt5875
    @harshitbhatt5875 3 года назад +9

    Please, if possible, explain how you approach a problem and come up with solutions too as it'll help in developing our programming logic as well. Thanks for the great vids, keep em comin'! :)

  • @CodeSuccessChronicle
    @CodeSuccessChronicle 3 года назад +2

    thanks for going through the whole string. Thank you for all your efforts 🙏

    • @techdose4u
      @techdose4u  3 года назад

      Welcome :)

    • @lionelmesssi2959
      @lionelmesssi2959 3 года назад

      Bro tomorrow my exam is there , exam will consist of coding question in Java. Dynamic programming also there can you help me for exam .

  • @vivek.tiwary
    @vivek.tiwary 3 года назад

    Could not find better explanation than this.

  • @dattatreyapujar4068
    @dattatreyapujar4068 5 лет назад +2

    Nice work. Hope to see your channel grow beyond numbers.

  • @PujaKumari-rp5sg
    @PujaKumari-rp5sg 7 месяцев назад

    If I had a teacher like you during college, I would never doubt myself that I can't learn DSA.

  • @jaatharsh
    @jaatharsh 4 года назад +1

    Thanks, TechDose, crisp n clear explanation, exactly what I was looking for, keep uploading!

  • @crankyinmv
    @crankyinmv 4 года назад +1

    Thanks. Very useful. However, brute force can be done in O(n^2):
    for(0 through length of string-1)
    find the longest palindrome whose middle is in that position
    if(longer than the previous max) save the start and end indexes
    return substring at the saved start and end indexes

  • @tarungopal3065
    @tarungopal3065 4 года назад +4

    Thanks for making this video. I watched lot of videos, on this topic but they explained only filling the DP table, but i couldn't understand why we should fill in such manner....your video did it......Nice and clear Explanation Thanks again.....

  • @prateeksrivastava1577
    @prateeksrivastava1577 3 года назад

    One of the best explanation for this problem.....Thanks bro...!!!!

  • @omerfarukbuyukbas
    @omerfarukbuyukbas 2 года назад

    It is really the best explanation I've ever seen in this subject! Thank you!

  • @yousufahmed985
    @yousufahmed985 11 месяцев назад

    You must be really smart to come up with solutions like these

  • @SalmanKhan-ol4sm
    @SalmanKhan-ol4sm 4 года назад +1

    This is the best explanation ever.

  • @abhishekjha4803
    @abhishekjha4803 3 года назад +1

    Bhai..kya samjhaya hai..ek number❤️❤️❤️❤️

  • @collins4359
    @collins4359 2 года назад

    thanks for the explanation. was so good I didn't need help writing the code.

  • @sangramkesharighosh1698
    @sangramkesharighosh1698 2 года назад

    Your explaining skill is mind-blowing 😁

  • @FREeZe_Reaper
    @FREeZe_Reaper 8 месяцев назад

    the best explanation i found

  • @darshansimha2166
    @darshansimha2166 4 года назад

    The best explanation so far!

  • @abhishekbaral4699
    @abhishekbaral4699 3 года назад

    really understood the concepts of DP with clarity. Never visualized like this before.. Thanks

  • @technovatives
    @technovatives 4 года назад +2

    best Explanation I have ever seen

  • @Star_Bawa9
    @Star_Bawa9 2 года назад

    Thanks , you get straight to the point continue like this

  • @ajeetshankar7946
    @ajeetshankar7946 2 года назад

    Quality content with best explanation compared to every other video, special thanks to you!!

  • @HarinathSrinivas
    @HarinathSrinivas 4 года назад +4

    For length 3 also it is enough to check only if characters are equal, like length 2 as diagonal is always 1.

  • @Bobby-mf6fw
    @Bobby-mf6fw 4 года назад +1

    Best video of this programon youtube.
    Thankyou Sir

  • @saicharanpinninti548
    @saicharanpinninti548 9 месяцев назад

    very good explanation and this was my first dp problem really understands really well

  • @aakashparmar560
    @aakashparmar560 3 года назад

    God-level explanation.!! If possible please keep these videos coming.

  • @nishantsngl
    @nishantsngl 4 года назад +1

    Superb Bro... best ever explanation for this problem.

  • @msreenivasaprasad2214
    @msreenivasaprasad2214 4 года назад +1

    Very clearly explained . Thanks for helping me out brother.

  • @ayeshaadhikari6123
    @ayeshaadhikari6123 3 года назад

    No amount of thanks is ever going to repay the help you're lending us :) Thanks a tonne sir! Keep growing

  • @mandeep2192
    @mandeep2192 4 года назад +1

    it clears up my all doubts..
    thnx

  • @rishilapsiwala9503
    @rishilapsiwala9503 3 года назад

    Precise explanation man

  • @AnandKumar-kz3ls
    @AnandKumar-kz3ls 3 года назад

    if we have a string of length n then total number of substring possible are (n*(n+1)/2 ) not n^2 time complexity will be n^2 heres the code - string s;
    cin>>s;
    for(int i=0;i

  • @nikhilkaushal1615
    @nikhilkaushal1615 2 года назад +1

    Nicely explained!
    Thank you!

  • @revanth6476
    @revanth6476 3 года назад +1

    Thank u tech dose. lots of respect for u..

  • @AbhishekKumar-sp5yz
    @AbhishekKumar-sp5yz 5 лет назад +2

    your explanation is amazing.

  • @rajgupta5158
    @rajgupta5158 4 года назад +1

    you are best for beginners, thanks bhaiya

  • @deveshagarwal660
    @deveshagarwal660 5 лет назад +2

    Amazing video and nicely explained. Great job

  • @soumensinha305
    @soumensinha305 5 лет назад +3

    One of the best videos, try to make more videos with code in it.

    • @techdose4u
      @techdose4u  5 лет назад

      Thanks... I am not sharing code because all the codes are available online for the same logic :) If you find problem finding then you can always take my help. I will provide it.

    • @karthikp601
      @karthikp601 5 лет назад

      I want sir coding also plz provide coding also

    • @techdose4u
      @techdose4u  5 лет назад

      Okay.... I will soon provide the link to the blog with codes in it.

    • @techdose4u
      @techdose4u  5 лет назад

      @@karthikp601 I have added CODE LINK in description section of the video.

  • @kwakukusi4094
    @kwakukusi4094 2 года назад +1

    i wish I had come across this channel earlier, I'd have passed that interview

  • @HimanshuKumar-xz5tk
    @HimanshuKumar-xz5tk 4 года назад +1

    Finally I understood this problem!!!!!!!!!!!!!!!!
    THANKSSSSSSSSSSSSSS MANNNNNN

  • @Star_Bawa9
    @Star_Bawa9 2 года назад

    That was a brilliant Explaination...

  • @noobninja4882
    @noobninja4882 4 года назад +1

    THANKS A LOT FOR THE BEST EXPLANATION

  • @mahipalsingh-yo4jt
    @mahipalsingh-yo4jt 4 года назад +1

    thanx buddy for the video . keep providing these useful videos.........

  • @sanskaripatrick7191
    @sanskaripatrick7191 7 месяцев назад

    best explanation of this dp problem. Thank you so much🙏

  • @ashwinraj8918
    @ashwinraj8918 4 года назад +1

    Flawless explanation!!. Thank You!

  • @Mandeepsingh-jo5cf
    @Mandeepsingh-jo5cf 3 года назад +1

    Thanks man for these explanations.

  • @ajaywadhwa3398
    @ajaywadhwa3398 4 года назад +1

    Awesome explanations !!

  • @manishbolbanda9872
    @manishbolbanda9872 2 года назад

    wow this is gold. such a great solution. Thanks a ton. i usually approach dp problem with rec first then memoization then tabulaiton. bt this is more like concrete tabulation solutiion.

  • @rahul88632
    @rahul88632 Год назад

    Thanks for simple explanation

  • @sarthakvaish2520
    @sarthakvaish2520 2 года назад +1

    Very nicely explained😇

  • @tmzpanda
    @tmzpanda 4 года назад +1

    1:41 dynamic programming (boolean[n][n])
    14:43 O(n^2)
    Lintcode: www.lintcode.com/problem/longest-palindromic-substring/description

  • @pranjalgupta9427
    @pranjalgupta9427 3 года назад +1

    Awesome explanation😄

  • @ankitdoot6186
    @ankitdoot6186 4 года назад +2

    In fact, we could solve it in O(N2) time without any extra space.
    We observe that a palindrome mirrors around its center. Therefore, a palindrome can be expanded from its center, and there are only 2N-1 such centers.
    You might be asking why there are 2N-1 but not N centers?
    The reason is that the center of a palindrome can be in between two letters.
    Such palindromes have even number of letters (such as “abba”) and their center are between the two ‘b’s.
    Since expanding a palindrome around its center could take O(N) time, the overall complexity is O(N2).
    Source : InterviewBit

  • @bhumberg3243
    @bhumberg3243 3 года назад

    The BEST explanation ...tqsm

  • @AbhishekKumar-yv3od
    @AbhishekKumar-yv3od 2 года назад +1

    you said in the video at 1:09 that o(n) total substring possible o(n2) is it right?
    Input : str = “abc”
    Output : 6
    Every substring of the given string : “a”, “b”, “c”, “ab”, “bc”, “abc”
    Input : str = “abcd”
    Output : 10
    Every substring of the given string : “a”, “b”, “c”, “d”, “ab”, “bc”, “cd”, “abc”, “bcd” and “abcd”
    it should be Count of substrings is n*(n+1)/2 right??😥

    • @techdose4u
      @techdose4u  2 года назад

      Your formula is O(N^2) when it comes to amortized time :)

  • @piyusgupta9498
    @piyusgupta9498 4 года назад +1

    Awesome explanation, finally I understood, thanks.

  • @adityaojha2701
    @adityaojha2701 3 года назад +2

    Thanks Sir for this good explanation!!

  • @SreyesSrinivasan
    @SreyesSrinivasan 2 года назад

    Fabulous explanation!