Medium20 min
Two Sum
Return the indexes of two distinct numbers in value whose sum equals extra. Each input has exactly one solution.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[[2,7,11,15],9]Output:
[0,1]Input:
[[3,2,4],6]Output:
[1,2]Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.