Dsa
Arrays
Medium
Consecutive Triplet Sum
Given an array of integers, find the maximum sum of any three consecutive elements. Output the maximum sum discovered.
Input:
- The first line contains an integer n, the number of elements in the array (1 ≤ n ≤ 100).
- The second line contains n space-separated integers representing the elements of the array.
Output:
- A single integer representing the maximum sum of three consecutive elements.
Example:
Input:
6
1 2 3 4 5 6
Output:
15
Key concepts
arrayssumswindow
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