Maximum number of subsegments in a circle array

Viewed 102

There are n positive numbers (A1 , ... An) on a circle, how do we divide this circle into subsegments with sum greater or equal to m so that number of subsegments are maximum in O(n) , or O(nlogn)

eg : n = 6 m = 6

3 1 2 3 6 3

ANS = 3 since we can divide the array into three subsegments{[2,4],[5,5],[6,1]}

1 Answers
Related