you give 0indexed integer array num multiplier size n m respectively n mYou begin score 0 you want perform exactly m operation on ith operation 0indexed willchoose integer x start end array numsAdd multipliersi x scoreNote multipliers0 correspond operation multipliers1 second operation onRemove x numsreturn maximum score perform m operation Example 1input num 123 multiplier 321output 14explanation an optimal solution follow Choose end 123 add 3 3 9 score Choose end 12 add 2 2 4 score Choose end 1 add 1 1 1 scorethe total score 9 4 1 14example 2input num 533271 multiplier 105346output 102explanation an optimal solution follow Choose start 533271 add 5 10 50 score Choose start 33271 add 3 5 15 score Choose start 3271 add 3 3 9 score Choose end 271 add 1 4 4 score Choose end 27 add 7 6 42 score the total score 50 15 9 4 42 102 Constraintsn numslengthm multiplierslength1 m 300 m n 1051000 numsi multipliersi 1000