6 kyu
Closest Sum
322 of 566smepple
Description:
Given an array (ints) of n integers, find three integers in arr such that the sum is closest to a given number (num), target.
Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
closest_sum([-1, 2, 1, -4], 1) # 2 (-1 + 2 + 1 = 2)
Note: your solution should not modify the input array.
Fundamentals
Similar Kata:
Stats:
Created | Jul 7, 2016 |
Published | Jul 7, 2016 |
Warriors Trained | 1393 |
Total Skips | 40 |
Total Code Submissions | 4508 |
Total Times Completed | 566 |
Ruby Completions | 86 |
Python Completions | 322 |
JavaScript Completions | 179 |
CoffeeScript Completions | 9 |
Haskell Completions | 16 |
Total Stars | 30 |
% of votes with a positive feedback rating | 86% of 167 |
Total "Very Satisfied" Votes | 130 |
Total "Somewhat Satisfied" Votes | 28 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 7 kyu |