⌘K
Flycodx

Maximum Consecutive Overs Runs

Maximum Consecutive Overs Runs

MediumArrays100% accepted

Arjun analyzes his cricket team's performance in the Mumbai domestic league. He has an array of runs scored in each over and needs to find the longest continuous sequence where total runs exceeded a target threshold to qualify for bonus points.

Approach

Given an array of over-wise runs and a target sum, find the length of the longest subarray with sum >= target.

Input

n=8 target=20 arr=[3,5,7,4,8,6,2,5]

Output

4
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