Palindromic Substrings | Blueprint | Palindrome Problems | 4 Approaches | Leetcode 647

Sdílet
Vložit
  • čas přidán 7. 09. 2024

Komentáře • 91

  • @codestorywithMIK
    @codestorywithMIK  Před 7 měsíci +43

    I am not well guys . Having bad throat and fever.
    Hope my voice sounds fine in the video.
    Thank you all for the support and love ❤❤
    iPAD PDF NOTES - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/Leetcode-647-Palindromic%20Substrings.pdf

    • @chillkro25
      @chillkro25 Před 7 měsíci +1

      U r as usual rock ❤🚒🔥

    • @AmanKumar-qz4jz
      @AmanKumar-qz4jz Před 7 měsíci

      @codestorywithMIK can u teach greedy. can u start a series!!

    • @sarcastic5561
      @sarcastic5561 Před 7 měsíci

      take care bhaiya !! ur way of explaining the problems are so good that coding has now become a habit

    • @user-ub2is4rs4x
      @user-ub2is4rs4x Před 7 měsíci

      Take care king

    • @oqant0424
      @oqant0424 Před 7 měsíci

      Hope u have a speedy recovery💖💖

  • @wearevacationuncoverers
    @wearevacationuncoverers Před 7 měsíci +13

    This easily beats any paid course available on market.

  • @najamsaqib2013
    @najamsaqib2013 Před 7 měsíci +8

    You are making DP concepts so easy for people like me who always had fear of DP😊

  • @FifthArima
    @FifthArima Před 7 měsíci +6

    02:36 Brute Force without memoization
    10:12 Brute Force with memoization
    18:02 Dynamic Programming - Bottom Up Approach
    45:06 Expanding from midpoint of palindrome for Even and Odd length palindrom(Smart Approach)

  • @VivekGupta-in5qu
    @VivekGupta-in5qu Před 7 měsíci +2

    I dontt know whether you will be reading this comment or not but let me tell you that your teaching style and effor are commendable

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      It means a lot. Thank you for your kind words ❤️🙏

  • @killeraloo3247
    @killeraloo3247 Před 5 měsíci +3

    Accha samjhaya, mujhe 4th solution mast laga.
    Space complexity O(n^2) se direct O(1).

  • @anshumaan1024
    @anshumaan1024 Před 7 měsíci +4

    3rd approach boht mast lagi, 4th bhi thik hai 🙂🙂

  • @AmitYadav-og7ep
    @AmitYadav-og7ep Před 7 měsíci +2

    Brother your way of speaking and explaining is really beautiful, wish you the best

  • @user-ub2is4rs4x
    @user-ub2is4rs4x Před 7 měsíci +3

    Goodness. The quality of the explanation is just 🔥

  • @k.satish3663
    @k.satish3663 Před 7 měsíci

    clean and clear explanation. Thank you so much for the video.wish you a speedy recovery.

  • @FifthArima
    @FifthArima Před 7 měsíci +2

    man i solved this with 3 approaches before coming here,
    1. bruteforce without memoization : O(n^3) time and O(1) space
    2. bruteforce with memoization: O(n^2) time and O(n^2) space
    3. expanding sideways from mid point approach : O(n^2) and O(1) space
    im bad in dp so, i tried looking online to understand but i didnt understand any approach . Yours dp explanation with bottom up approach somewhat made sense.
    Also, there is a algo called - manacher algo(got to know from chatgpt suggestions on how to improve the solution better). Maybe you can create another video on how to solve using that one.
    I would suggest you to put i time frames in your video mentioning just Approach 1 from xx:xx to yy:yy. this helps to navigate easily. AND thanks man!

    • @DManikandan-cw2cw
      @DManikandan-cw2cw Před 7 měsíci

      Bro brute force with memo shouldn't be greater than O(n^2) as we r calculating wether a substring is palindrome or not once for every substring aren't we?
      @codestorywithMIK

    • @FifthArima
      @FifthArima Před 7 měsíci

      @@DManikandan-cw2cw bro worst case possibility when doing memoization can have o(n*n) substrings in the storage . Hence o(n^2) space. Open to discuss , correct me if I’m wrong !!

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 Před 7 měsíci

    Good explanation blueprints is most important. i have see first time this blueprints in ytube thanks for 18k+ subscription 🎉

  • @ashutoshchoubey369
    @ashutoshchoubey369 Před 7 měsíci

    Bhai aapki videos ko dekhke to aisa lagta hai ki agar agle 3-4 mahine me maine koi job nhi crack ki to competition aasmaan me pahunch jayega. Aap jaisa padhate ho koi mechanical wala bhi 3 mahine me coder ban jaye.. :)

  • @satvrii
    @satvrii Před 7 měsíci

    Omg bhaii iss level ki dedication se explain krna iss so inspirational ❤❤❤❤❤ thanks a lot, don't have enough words to thank you

  • @satvikpandey700
    @satvikpandey700 Před 6 měsíci

    That's what we call quality Content!

  • @akhilchauhan9417
    @akhilchauhan9417 Před 7 měsíci +1

    We can simplify the conditional statements in the bottom up approach:
    if s[i] == s[j] and (l

  • @souravjoshi2293
    @souravjoshi2293 Před 7 měsíci

    Hats off to the level of explanation mik. You are just nailing it.

  • @beenasatyendrapal6405
    @beenasatyendrapal6405 Před 7 měsíci +1

    get well soon sir...

  • @rohitdayal9222
    @rohitdayal9222 Před 7 měsíci +2

    Can you make videos on GFG PODT too? It's great help if you can.

  • @sushantkapoor9002
    @sushantkapoor9002 Před 7 měsíci

    Great video. I wanted to request if you could list problems that can be solved using the blueprint you mentioned. I wanted to test it out. Thanks !

  • @sohamjoshi25
    @sohamjoshi25 Před 7 měsíci

    Great Video, Great Explanation!! Could follow whole video with intrest.

  • @k-CE-OmkarPathak
    @k-CE-OmkarPathak Před 7 měsíci

    Content on fire 💥💥
    All solutions explained!! op

  • @Momentsofmagic28
    @Momentsofmagic28 Před 7 měsíci

    Awesome and my one stop solution as always.

  • @tutuimam3381
    @tutuimam3381 Před 7 měsíci +1

    Amazing explanation ❤

  • @RUSTYYYYYYYYY
    @RUSTYYYYYYYYY Před 7 měsíci

    Chummesawari video😘

  • @joydeep-halder
    @joydeep-halder Před 7 měsíci

    Thank you so much for the blueprint ❤

  • @anonymous090
    @anonymous090 Před 7 měsíci

    Thank you so much bhaiya.... get well soon

  • @alokgautam02
    @alokgautam02 Před 7 měsíci

    thnx bro for such detailed explaination

  • @oqant0424
    @oqant0424 Před 7 měsíci

    POTD DONE [10.2.24] ✅✅

  • @sachinjain3833
    @sachinjain3833 Před měsícem

    Is the approach 4 is called as Manacher's algorithm?

  • @kartikforwork
    @kartikforwork Před 5 měsíci

    i think you are mistaking the brute force with memo, the memo only gonna send its prestored value for the case when the sub sting has repeated characters.
    like for "kkkkk" memo is useful, but for "aback" momo never work, not even in the case of "abba" memo work.
    i have varified then by just cout before returning the memo value

  • @user-dx2dd2kk9o
    @user-dx2dd2kk9o Před 6 měsíci

    brother what will be the time complexity of blue print code

  • @ritishrai581
    @ritishrai581 Před 7 měsíci

    I didn't get the time complexity for the brute and recursive . I'm considering it like this that i and j goes for every substring that exists in the string right? and then isPalinChecker basically iterates through the length of the substring . Total no of substring = n*(n+1)/2 and lets say the avg length of each substring is M then won't the tc be O(N^2 * M) and also if we memoize it we will just reduce M not technically eliminate it So its better than cubic but we can't call it totally to be a n squared.

  • @nishkarshpal
    @nishkarshpal Před 7 měsíci +1

    Me solving LC daily with one approach
    Meanwhile MIK coming up with 4 approaches 🗿

  • @gauravbanerjee2898
    @gauravbanerjee2898 Před 7 měsíci

    Thanks a lot bhaiya for the god level explanation ❤❤

  • @yuvhrajverma9665
    @yuvhrajverma9665 Před 7 měsíci

    Sir approach 3 is gap method?

  • @ReshuSharma-jc7yu
    @ReshuSharma-jc7yu Před 7 měsíci

    bhaiya hum substring recursion ke through nhi nikal sakte kya

  • @shraddhanandvikar8505
    @shraddhanandvikar8505 Před 7 měsíci

    @codestorywithMIK
    what is the time complexity of 4th approach?

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      It’s O(n^2) because we are running for loop for picking each character i
      Then for each one of them you are trying to expand.

  • @Ankitkumar-fz3kc
    @Ankitkumar-fz3kc Před 7 měsíci +1

    Sir is it possible for you to start a small cohort for DSA as i'm looking to learning from you as from you i learnt a lot and want to learn more with you.

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      Hi Ankit,
      Can you elaborate what’s cohort ?
      Sorry I am not aware of this term 😅

    • @Ankitkumar-fz3kc
      @Ankitkumar-fz3kc Před 7 měsíci

      @@codestorywithMIK it's like taking at max 100 people and teach them and guide them personally.

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci +1

      I see.
      Let me try to make a plan for that soon.

    • @Ankitkumar-fz3kc
      @Ankitkumar-fz3kc Před 7 měsíci +1

      @@codestorywithMIK yes sir please consider it. It will be very helpful for someone like me.

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      @Ankitkumar-fz3kc definitely ❤️❤️

  • @kennyackerman5429
    @kennyackerman5429 Před měsícem

    Bhai ye first solution ka on³ hona chaiye na n² kese

  • @rohitdayal9222
    @rohitdayal9222 Před 7 měsíci

    Great Bhai🔥🔥

  • @rishabhjoshi8525
    @rishabhjoshi8525 Před 7 měsíci +1

    Is it okay to not being able to solve this problem even after solving 30-40 problems on DP? 😭

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      That’s totally fine. Don’t worry. Keep practising, slowly and steadily you will be able to win this

  • @39_jatinjain4
    @39_jatinjain4 Před 7 měsíci

    worst case ~10^9 o(n^3) please tell me how it is possible without showing TLE.

  • @abc-ym4zs
    @abc-ym4zs Před 7 měsíci

    sir please arrange your dp videos in difficulty order bhaiya

  • @avnish-wf8rv
    @avnish-wf8rv Před 7 měsíci

    sir please check if java 2nd approach if its working?

  • @shabananoor9423
    @shabananoor9423 Před 7 měsíci +1

    ❤❤❤

  • @VivekGupta-in5qu
    @VivekGupta-in5qu Před 7 měsíci

    Hi Mik 4th approach ai confusion hai , har character ke liye odd adn even length kyu le rhe hai ?

    • @codestorywithMIK
      @codestorywithMIK  Před 7 měsíci

      There are many palindromes hidden in the string. And each character can be the center of those palindromes. There can be even length palindromes and odd length palindromes.
      For even length a single character can’t be the centre and hence need to consider with its adjacent (i+1) character to become centre of palindrome and try expanding.
      For odd length, every character can try to become centre and expand to see palindromes.

  • @mohdalizilani9896
    @mohdalizilani9896 Před 7 měsíci +1

    for the 3rd approach why i can not write loop like normal i to n and j = i to n ie. for (int i = 0 ; i

  • @bhartendupant8859
    @bhartendupant8859 Před 7 měsíci

  • @xiaoshen194
    @xiaoshen194 Před 7 měsíci +1

    Good video, but it could have been better if u would have explained string hashing algo solution too😅. This is a reference video czcams.com/video/1thnThrIzwg/video.htmlsi=ynn040ejMQx96CVt
    Very long video but recommended if u have time 👍

    • @xiaoshen194
      @xiaoshen194 Před 7 měsíci +1

      Wait r we gonna ignore the fact that an O(n³) solution passed with max(n) = 1000? Test cases not set properly...

    • @ritishrai581
      @ritishrai581 Před 7 měsíci

      @@xiaoshen194 how is it n^3 the palin check functoin doesn't necessarily iterates through the whole string it just goes for the length of the substring . Can you please explain

    • @xiaoshen194
      @xiaoshen194 Před 7 měsíci +1

      @@ritishrai581 length of subs can be O(n) in worst case

  • @Sahilsharma-sk5vr
    @Sahilsharma-sk5vr Před 7 měsíci

    respect

  • @user-bf7yz3qd2i
    @user-bf7yz3qd2i Před 7 měsíci

    Bhai Thora Chhota video banaya kro, itne lambe video time waste krte hai , main intuition de Diya kro starting me , fir continue kro apna Gyan.

  • @basma-ba
    @basma-ba Před 6 měsíci

    i don't understand, if the video in hindi or other language, mention it in title so you will not waste people's time!

    • @codestorywithMIK
      @codestorywithMIK  Před 6 měsíci +2

      I apologise for the inconvenience.
      I will take care of it

    • @basma-ba
      @basma-ba Před 6 měsíci +1

      Thank you for that!
      I was frustrated when I discovered that your video, the third one I clicked on, was in a language other than English.
      Despite this, I wish you all the best, and I hope you consider explaining the problems in English to connect with a broader audience@@codestorywithMIK

    • @codestorywithMIK
      @codestorywithMIK  Před 6 měsíci +1

      Definitely. I will try to make English videos soon.
      Thank you for your precious suggestions ❤️

  • @rounaq_khandelwal
    @rounaq_khandelwal Před 7 měsíci +1

    MIK, your breakdown of this question is like having four unique flavors in a delicious explanation! Excellent job in making it clear and easy to understand. 🦸

  • @saurabhKumar-hj6yp
    @saurabhKumar-hj6yp Před 7 měsíci

    ❤❤

  • @codeandtalk6
    @codeandtalk6 Před 7 měsíci

    ❤❤❤