⌘K
Flycodx

Maharashtra Sugar Mill Capacity Optimization

Maharashtra Sugar Mill Capacity Optimization

MediumArrays0% accepted

Kumar schedules production across Maharashtra sugar mills to maintain operational efficiency. He needs to identify periods where mill production stays within safe capacity limits to prevent equipment strain. Input: N, then minCap and maxCap, then N production readings. Return the longest streak of consecutive readings within [minCap, maxCap].

Approach

Given N production readings and capacity range [minCap, maxCap], find the length of the longest subarray where all values remain strictly within capacity limits.

Input

6 40 100 50 75 30 85 110 95

Output

2
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3