Find pair with given sum and pair with sum closest to a number
Filed under ITC InfoTech
The question
Given an array of numbers, first find a pair that adds up to a given sum. Then solve a modified version: find the pair whose sum is closest to a given number.
No write-up yet. Related questions below have one.
Related ITC InfoTech questions
Collected from public candidate posts and coding forums. Updated Nov 2026.