⌘K
Flycodx

Festival Months Peak Visitors

Festival Months Peak Visitors

MediumArrays0% accepted

A Hindu temple in Varanasi tracks monthly visitor counts throughout the year. Arjun needs to find the most popular K consecutive months to plan special prayers and accommodations accordingly.

Approach

Given an array of N monthly visitor counts, find the maximum sum of any K consecutive months.

Input

5 2 100 150 80 120 200

Output

320
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