PRACTICE / UNDERSTAND / REPEAT
Data Structures & Algorithms practice question
Practice two pointers with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
1 questionAnswers explainedFree · no login
Try this question
In the sorted array [1, 2, 5, 9], the target sum is 10. The pointers initially select the first and last elements. What is their sum?
Answer & explanation
Answer: 10
The initial pair contains n and n + 8, which already equals the target.