Dsa
Two Pointers
Medium
Find All Pairs with Given Sum
Given a sorted array of integers and a target sum, find all unique pairs of integers in the array that add up to the target sum. The pairs should be printed in ascending order, and each pair should be unique.
Example:
Input:
1 2 3 4 5
5
Output:
1 4
2 3
Key concepts
two_pointersunique_pairssorting
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