Banana, Amazon’s super intelligent virtual assistant, simplifies tasks such as configuring your Banana-supported gadgets, playing podcast, delivering weather forecasts, and more. The development team is crafting a new feature that recommends the best days for fishing based on weather predictions.
Based on recent research, a day qualifies as suitable for fishing if the rainfall levels have been non-increasing over the past "window" days leading up to that specific day and are non-decreasing during the following "window" days after it.
You are given the projected rainfall amounts for the next n days in a list called forecast. Your task is to identify all days that meet this criterion. Formally, a day is ideal if the following condition holds true:
Return a list of such ideal days, sorted in ascending order. Remember, the i-th element in the forecast array corresponds to the data for day i + 1 (1-based reference).
✅ Note: There is always at least one valid ideal day guaranteed.
Parameters:
forecast[n]: A list of integers representing the predicted rainfall amount for each upcoming day.
window: Just an integer..
forecast = [3, 2, 2, 2, 3, 4] window = 2 return = [3, 4]

forecast = [1, 0, 1, 0, 1] window = 1 return = [2, 4]
forecast = [1, 0, 0, 0, 1] window = 2 return = [3]
forecast = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] window = 3 return = [4, 5, 6, 7]
window ≤ n ≤ 2 * 10^50 ≤
forcast[i] ≤ 10^9
- Count Promotional PeriodsOA · Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Get Minimum AmountOA · Seen Jun 2026
- Find Minimum CostOA · Seen Jun 2026
- Get Smallest Base SegmentOA · Seen Jun 2026
- Select Least Resource TasksOA · Seen Jun 2026
- Product Category Group SizesPHONE SCREEN · Seen May 2026
- Count Connected ComponentsPHONE SCREEN · Seen May 2026
public int[] findIdealDays(int[] forecast, int window) {
// write your code here
}