⌘K
Flycodx

Maximum Runs with Boundary Constraints

Maximum Runs with Boundary Constraints

HardArrays0% accepted

Virat's batting analysis requires finding peak form. Given delivery scores and bowler IDs, find the longest consecutive sequence containing exactly K boundaries, all from different bowlers, with total runs exceeding threshold.

Approach

Given runs array and bowler array, find max runs in subarray with exactly K boundaries and all different bowlers

Input

runs=[1,4,2,6,3,4,5], bowlers=[1,2,1,3,2,3,2], k=2

Output

12
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