Amazon Online Assessment 2021 (OA) - Efficient Harvest

A farmer uses pivot irrigation to water a circular field of crops. Due to varying conditions, the field does not produce consistently. The farmer wants to achieve maximum profit using limited resources for harvest. The field is segmented into a number of equal segments, and a profit is calculated for each segment. This profit is the cost to harvest versus the sale price a the produce. The farmer will harvest a number of contiguous segments along with those opposite. Determine the maximum profit the farmer can achieve.


This is a companion discussion topic for the original entry at https://algo.monster/problems/amazon_oa_efficient_harvest/