Description
Given an circular integer array (the next element of the last element is the first element), find a continuous subarray in it, where the sum of numbers is the biggest. Your code should return the index of the first number and the index of the last number.
If duplicate answers exist, return any of them.
Example
Give [3, 1, -100, -3, 4], return [4,1].
Solution
环形数组的问题都可以变成一维数组的问题,只要把长度为n的一维数组重复一次变成长度为2n的一维数组,在遍历时始终把subarray的长度限制在[0, 1]内就行了。