Palindrome Partitioning Dynamic Programming

Поділитися
Вставка
  • Опубліковано 27 гру 2024

КОМЕНТАРІ • 64

  • @blatogh1277
    @blatogh1277 3 роки тому +1

    that makes my life easier. In my opinion, to test whether is a palindrome, we just need to have a test function to go over the substring and determine whether this substring is palindrome or not.

  • @gyanasahu1006
    @gyanasahu1006 3 роки тому +2

    There is a better approach to constructing this dp table. The flaw here is we are constructing row by row and we have to look at row + 1 for updating dp[row][1..]. Do it by length, which is more intuitive. Below is the code:
    for(int i=1; i

  • @34_harshdeepraghuwanshi98
    @34_harshdeepraghuwanshi98 3 роки тому +1

    Awesome 15 min explanation

  • @hoyinli7462
    @hoyinli7462 2 роки тому +1

    you are the only 1 DP solution I really understand! Thank you!

    • @IDeserve
      @IDeserve  2 роки тому

      Thanks Ho Yin Li!!

  • @IDeserve
    @IDeserve  8 років тому

    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.

  • @haimbendanan
    @haimbendanan 8 років тому +4

    Why is the brute force n^3 ?
    All the string partition possibilities aren't 2^(n-1) ? Or am I missing something?
    Thanks!

    • @11m0
      @11m0 8 років тому

      I dont get it either...Did u figure this out?

    • @neerajjoshi9493
      @neerajjoshi9493 7 років тому +1

      actually brute force here refers to another DP approach which is not as good as this DP approach.

    • @manjesh80
      @manjesh80 6 років тому

      Its n^2 + n^2 . === n^2 ... compare to other approaches .. which is n^3
      If n = 1000
      n^2 ==> 1000000 ==> 1 Million
      n^3 == 1000000000 ==> 1 Billion
      n^2 + n^2 ==> 2 Million

    • @shiwanggupta8608
      @shiwanggupta8608 6 років тому +1

      Actually its not brute force..using brute force it would be O(n*2^n)
      using dynamic programming we can achieve O(n^2) using different approach
      www.geeksforgeeks.org/dynamic-programming-set-17-palindrome-partitioning/

  • @NitinSingh-hk3vy
    @NitinSingh-hk3vy 2 роки тому +1

    Thanks brother, this video helped me a lot🙌. Keep doing 👍

  • @anmoljain5846
    @anmoljain5846 3 роки тому

    thank you, sir. I was trying to get it from many resources, finally, I got it through this video

  • @aadityasharma9790
    @aadityasharma9790 2 роки тому +1

    you deserve more subscriber man!

  • @aniket7512
    @aniket7512 4 роки тому +3

    God Level Explanation. Thanks bro was finding this whole day !

    • @IDeserve
      @IDeserve  4 роки тому +1

      Wow! Thanks Aniket!

    • @aniket7512
      @aniket7512 4 роки тому

      @@IDeserve Bro u truly deserve it. I guess that's why u named d channel IDeserve😂....Jokes apart keep uploading great content 😊 ATB

  • @Ice-2706
    @Ice-2706 4 роки тому +2

    Thanks bro and keep posting more videos they are helpful !!

  • @pathikritchanda62
    @pathikritchanda62 3 роки тому +1

    Thank you sir for this approach , hope for such great content in future too .

  • @lifehacks9450
    @lifehacks9450 4 роки тому +2

    Please upload more why did u stopped

  • @anonymoussloth6687
    @anonymoussloth6687 2 роки тому

    Brute force would be 2^n because u r not checking all substrings. U r checking all valid cuts. You have n positions where you can place the cut and you have two options at each position to cut it or not cut it

  • @himanshusrihsk4302
    @himanshusrihsk4302 5 років тому +1

    Best Explanation ever. Sir plz provide solutions for problem in leetcode medium and hard questions

  • @Vinny254
    @Vinny254 3 роки тому

    Tried to print the substrings ... anyone managed to get the minimum substrings as a list instead ?

  • @namanvijay3514
    @namanvijay3514 3 роки тому +1

    Best explanation 👍

  • @bhavukgarg3619
    @bhavukgarg3619 5 років тому +1

    Sir your videos are always helpful, Just got to search for that ideserve logo, and my doubts are clear.

    • @IDeserve
      @IDeserve  5 років тому

      Thanks for your kind words Bhavuk!

  • @karthiknedunchezhiyan5136
    @karthiknedunchezhiyan5136 7 років тому +1

    Instead of keeping boolean matrix it is easy to count the minimum cut in matrix itself.....
    then return top right corner value

  • @sujan_kumar_mitra
    @sujan_kumar_mitra 3 роки тому +1

    Nice Explanation

  • @justanaverageguy4739
    @justanaverageguy4739 4 роки тому

    this is O(n^3) solution right?

  • @mohakchaudhary1981
    @mohakchaudhary1981 5 років тому +1

    Best explanation of this problem 🎈⚡⚡😀

  • @kushal1
    @kushal1 4 роки тому +2

    Great video... Just one thing I didn't get the intuition behind dp[j] + 1. Difficult to understand. Dry run makes little more sense but still. Could have been explained better.

  • @falakk22
    @falakk22 7 років тому +1

    Amazing , please keep adding more probs . Is there any book that we should refer to look out for such questions ? Any recommendation . Thanks .

    • @vorasagar7
      @vorasagar7 7 років тому

      solve leetcode or use ctci for questions

  • @varunkunchakuri1204
    @varunkunchakuri1204 8 років тому

    i don't think there is brute force way of o(n^3) please check

    • @pownarthithimiridayasagar2229
      @pownarthithimiridayasagar2229 8 років тому

      I think, by Brute force they mean calculating min cut for every possible substring in the string.

    • @bipul2138
      @bipul2138 4 роки тому

      That one is also based on DP

  • @harveylastname1523
    @harveylastname1523 8 років тому +1

    The table of 2D information is not used all, you can save the integer but not boolean only.Save the min(T[i][j] = 1+ Min(T[i][k] , T[k][j-1]) to the table 2D, so the T[i][j] is the answer.

  • @rishitgupta7848
    @rishitgupta7848 3 роки тому +1

    Thank you!

  • @chrisogonas
    @chrisogonas 3 роки тому +1

    WOW, that was helpful. Thanks

  • @ameyapatil1139
    @ameyapatil1139 4 роки тому +1

    Excellent work !

  • @08JuHan
    @08JuHan 5 років тому +1

    great tutorial! thanks a lot for your help

  • @SurendraSingh-hp9gk
    @SurendraSingh-hp9gk 5 років тому +1

    thank you ideserve.

  • @Sushil2874
    @Sushil2874 4 роки тому +1

    Nice explanataion..!!

  • @varunnarayanan8720
    @varunnarayanan8720 4 роки тому +1

    Well explained..

  • @mkay7800
    @mkay7800 3 роки тому +1

    Its Awesome 🔥🔥

  • @vicentefelipe4287
    @vicentefelipe4287 7 років тому

    loved this video, super helpful, can you do Palindrome Partitioning, where you return all possible palindrome partitioning of s. For example, given "aab". return [["aa","b"], ["a","a","b"]]

  • @karthiksharma8720
    @karthiksharma8720 5 років тому +1

    Sir you are awsome

    • @IDeserve
      @IDeserve  5 років тому

      Karthik you are awesome 😊

  • @lemonginger001
    @lemonginger001 7 років тому

    explained nicely :)

    • @IDeserve
      @IDeserve  6 років тому

      Thank you so much Yash for your kind words :)

  • @ZiiiP2142
    @ZiiiP2142 7 років тому +1

    Awesome.

    • @IDeserve
      @IDeserve  7 років тому

      Thanks primaltare 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.

  • @shaivalchokshi3424
    @shaivalchokshi3424 9 років тому +1

    Nice, thank you :)

    • @IDeserve
      @IDeserve  9 років тому

      +shaival chokshi
      Thanks a lot for your words! It is very encouraging to hear such comments!
      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.
      We are uploading new topics everyday.
      Please check it out and leave us a comment there!
      Thanks,
      -Team IDeserve.

    • @shaivalchokshi3424
      @shaivalchokshi3424 9 років тому

      Yes, i've been watching a lot of videos of yours :) they're all too helpful

    • @IDeserve
      @IDeserve  9 років тому

      +shaival chokshi
      Thanks a lot for appreciating!