LearnPy Hub
← Arena
IntermediateRating 1300

Closest Pair Sum

Find two different elements whose sum is closest to target. Print that sum; if two sums are equally close, the smaller one.

Input

n target, then n integers.

Output

A number.

Sample 1

Input
5 10
1 3 4 7 10
Output
10

Sample 2

Input
2 0
-1 2
Output
1
solution.py
Output appears here
Closest Pair Sum · Python Arena problem · LearnPy Hub