Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

You are provided n numbers (both +ve and -ve). Numbers are arranged in a circular form. You need to find the maximum sum of consecutive numbers.

Input Format it contains an integer n which is the size of array and next line contains n space separated integers denoting the elements of the array.

Constraints 1<=n<=1000 |Ai| <= 10000

Output Format Print the maximum circular sum

Sample Input 7 8 -8 9 -9 10 -11 12 Sample Output 22 Explanation Maximum Circular Sum = 22 (12 + 8 - 8 + 9 - 9 + 10)