3 ms·
> I think it's a little trickier than that, since the problem asks for the indices not the numbers, which would be lost in the sorted version. Good point. > Y
by tromp 3y ago
> I think it's a little trickier than that, since the problem asks for the indices not the numbers, which would be lost in the sorted version.
Good point.
> You'd have to keep an additional mapping from the sorted to original positions.
It's simpler to just find the two numbers in the original unsorted array.