3496. Maximize Score After Pair Deletions
You are given an array of integers
nums. You must repeatedly perform one of the following operations while the array has more than two elements:
- Remove the first two elements.
- Remove the last two elements.
- Remove the first and last element.
For each operation, add the sum of the removed elements to your total score.
Return the maximum possible score you can achieve.
1 | class Solution { |