Question bank › Arrays
Dsa Arrays Easy

Sorted Subarray Sum

You're given a sorted array. Find all unique pairs of elements such that their sum is equal to a given target value. Input: The first line contains two integers, n (1 <= n <= 10^5) and target (1 <= target <= 10^9). The second line contains n space-separated integers, the sorted elements of the array. Output: Print each unique pair of indices (i, j) such that arr[i] + arr[j] = target. Example: Input: 5 10 1 2 3 7 8 Output: (2, 3)

Key concepts

arraystwo pointerssubarrays

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.