Explanation of testCase (Alice and Bob)

Please explain, how 27 is the maximum answer for the given test case.

7 2 1 8 3 3 6 6
she picks 3
remaining array
7 1 8 3 6 6 score = 3, again picks 3
7 1 8 6 6 score = 6, picks 6
1 8 6 6 score = 12, picks all the remaining elements in any order and add them
total score = 27
it is a[k] +1 and a[k] -1 and not a[k-1] and a[k+1]

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.