Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Consider simulating the process to calculate the answer
iterate until the array becomes empty. In each iteration, concatenate the first element to the last element and add their concatenation value to the answer.
Don’t forget to handle cases when one element is left in the end, not two elements.