Two Sum Min Index (retired)
Description:
Given an array of integers numbers and an integer target, find the indices of two numbers in the array such that they add up to the given target.
You may not assume that each input would have exactly one solution, and you may not use the same element twice. However you may assume that each array has a length of at least two
You should return the sum of the indices that have the lowest. If there are no possible sums, return -1
EX1: Given the array [8, 4, 2, 6, 12, 43, 95, 14] and target 18, there should be two solutions (6,12) and (4, 14) The indices are [3,4] and [1,7] respectively.
Your output should be 7 as 3 + 4 < 1 + 7 (7 < 8)
Ex 2: Given the array [1, 2] and target 4, we can see that there is no way to get a sum of 4 using 1 + 2 so in this case your output should be -1
Similar Kata:
Stats:
Created | Aug 16, 2023 |
Warriors Trained | 7 |
Total Skips | 0 |
Total Code Submissions | 10 |
Total Times Completed | 5 |
JavaScript Completions | 1 |
Python Completions | 5 |
Total Stars | 0 |
% of votes with a positive feedback rating | 0% of 4 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 3 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |