Dsa
Sliding Window
Medium
Max Sum of K Consecutive Numbers
Write a program to find the maximum sum of any consecutive k numbers in a given list of integers.
Input format:
The first line contains space-separated integers representing the list.
The second line contains a single integer k.
Output format:
Print the maximum sum of any k consecutive numbers.
Example:
Input:
1 2 3 4 5
3
Output:
12
Key concepts
sliding_windowarray_manipulation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now