Is 312. Burst Balloons example wrong?


  • 0
    P

    Example:

    Given [3, 1, 5, 8]

    Return 167

    nums = [3,1,5,8] --> [3,5,8] -->   [3,8]   -->  [8]  --> []
    

    coins = 3x1x5 + 3x5x8 + 1x3x8 + 1x8x1 = 167

    But I can easily get better by doing

    nums = [3,1,5,8] --> [3,5,8] -->   [5,8]   -->  [8]  --> []
    

    coins = 3x1x5 + 3x5x8 + 1x5x8 + 1x8x1 = 183

    So who is wrong?


  • 0
    Y
    This post is deleted!

Log in to reply
 

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