Challenge Information

Title : Collect Coins
Difficulty : Medium
Solutions : 7
Maximum Score : 100
Completed by You: No
Description :

There is an array of even lengths given. The elements of an array represent coins of different values. You have to select either the first or last coin from the row and determine the maximum possible amount you can get.

Write a function solve that have the following parameter(s):
1.) arr = an array of integer

Example
Input:
arr = [1, 8, 2, 10]
Output:
18

Explanation
The maximum number you get from collecting coins of value 8 and 10 is 18.

Constraints

Judocode