Independence Day Sale! Unlock 40% OFF on All Job-Oriented Training Programs – Limited Time Only! Offer Ending in
D
H
M
S
Get Now
Problem Submissions Solution

Maximum fruit gathering by birds

Difficulty: Easy

Acceptance: %

Points: 20.00

There are several trees arranged in a circle, each with a fruit value associated with it. A bird can gather all the fruits from a tree by sitting on it for 0.5 seconds and can move to a neighboring tree in another 0.5 seconds. Once all the fruits are picked from a tree, the bird cannot pick any more from that tree until all fruits are picked, it cannot move to next tree. The bird has totalTime seconds to gather as many fruits as possible and can start from any tree.


Given the array arr[] of fruit values and totalTime, determine the maximum number of fruits the bird can gather.

Topics

Companies

Articles

Examples:

NA

Constraints:
  • 2 = arr.size() = 106
  • 1 = totalTime = 108
  • 0 = arr[i] = 105
Companies:
Meta
Topics:
Array
Locked Content
Access Restricted: Please Login to access the code editor and test cases.