Given two arrays, (say [1,3,5] and [2,4]) and a number target (say 7), assume we sort by the sum of any pair of elements from each array, return the smallest index.

In this example, the result is 3.

Pair, Sum, Index

(1,2), 3, 0

(1,4), 5, 1

(3,2), 5, 2

(3,4), 7, 3 <- result

(5,2), 7, 4

(5,4), 9, 5