Balloon burst problem


  • 1
    P

    Balloon burst problem

    A. 2 3 5 , if we burst balloon 3 then sum is 2*5= 10
    And array become 2 5

    B. if we burst balloon 2 then sum is 5 + 10 = 15
    And array becomes 5

    C. not we burst last balloon 5 then it return it's balloon

    And sum is now 15 + 5 =20

    How to solve using dynamic programming.
    I am weak in DP . Please help me out


  • 1
    S

    I'm suggesting edits to this question as follows:

    Balloon burst problem
    A) Given an array: 2 3 5 , if we burst balloon 3 then the sum is 2 + 5 = 7, and the array becomes 2 5 .
    B) If we burst balloon 2 then sum is 5 + 7 = 12, and the array becomes 5.
    C) Now we burst the last balloon: 5, and return it's balloon.
    Sum is now 12 + 5 = 17

    How do I solve this using dynamic programming?
    I am weak in DynamicProgramming . Please help me out.


  • 0
    P

    In my case there was multiplication . But I have no problem with the edit. I just want to know how to approach in case of backtracking. Because with backtracking in case of n=10 then output will be too slow.


  • 0
    C
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.