Dsa
Arrays
Easy
Consecutive Sum Check
Determine if any two consecutive numbers in an array sum to a specific value. If such a pair exists, print 'FOUND', or print 'NOT FOUND' otherwise.
Input Format:
- The first line contains an integer n (1 ≤ n ≤ 100), the size of the array.
- The second line contains n space-separated integers representing the elements of the array.
- The third line contains an integer k, the target sum.
Output Format:
- Print 'FOUND' if any two consecutive numbers sum to k, otherwise print 'NOT FOUND'.
Example:
Input:
5
3 4 2 1 5
6
Output:
FOUND
Key concepts
arraysconsecutivenesssum
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