OverloadedOsim

Explanation Suppose $1^{st}$ group will be formed index $1$ to index $2$, Then $a_1 + a_2 = 7$. Now, $k = 7\%10 = 7$. So, array $a$ will be $\{3 + 7 , 4 - 7, 2 + 7, 4 - 7, 5 + 7\} = \{10, -3, 9, -3, 12\}$. The first group cost will be $10 - 3 = 7$.


This is a companion discussion topic for the original entry at https://toph.co/p/operatorosim