I have two lists old
and new
, with the same number of elements.
I'm trying to write an efficient function that takes n
as a parameter, compares the elements of two lists at the same locations (by index), finds n
largest differences, and returns the indices of those n
elements.
I was thinking this would be best solved by a value-sorted dictionary, but one isn't available in Python (and I'm not aware of any libraries that offer it). Perhaps there's a better solution?