Retired
In unsorted array of integers, return the pair with the sum closest to N (retired)
24 of 25milesburton
Description:
This is a fairly popular interview question from Programmer Pearls.
The aim of the question is to return a pair of numbers which is as close to the target number as possible.
# array: [9,-3, -10, -4, -5], target: 4 == [9, -5]
# array: [1, -1, -2,-4], target: 0 == [1,-1]
# array: [0, 2, -10, 10, 5, 4], target: 0 == [-10, 10]
Algorithms
Interview Questions
Similar Kata:
Stats:
Created | Oct 7, 2013 |
Warriors Trained | 100 |
Total Skips | 16 |
Total Code Submissions | 81 |
Total Times Completed | 25 |
CoffeeScript Completions | 24 |
Total Stars | 1 |
% of votes with a positive feedback rating | 35% of 10 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 14 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 8 kyu |