We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'm not really sure how it works, but if you sort the data structure, finding the minimum is all about comparing consectutive indexes to each other instead of to every index. After this, we do our usual absolute value and minimum value.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
My Python3 solution:
I'm not really sure how it works, but if you sort the data structure, finding the minimum is all about comparing consectutive indexes to each other instead of to every index. After this, we do our usual absolute value and minimum value.