you give n balloon index 0 n 1 each balloon paint number represent array num you ask burst balloonsIf burst ith balloon numsi 1 numsi numsi 1 coin if 1 1 go bound array treat balloon 1 paint itreturn maximum coin collect burst balloon wisely Example 1input num 3158output 167explanationnums 3158 358 38 8 coin 315 358 138 181 167example 2input num 15output 10 Constraintsn numslength1 n 3000 numsi 100