Created
November 3, 2019 22:01
-
-
Save imedadel/68fe2f32e9dbc5f3f0497219a0f7fa18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def minimumAbsoluteDifference(arr): | |
| uniq = sorted(list(set(arr))) | |
| minVal = uniq[-1] | |
| for i in range(len(uniq)-1): | |
| newMin = min([abs(x-uniq[i]) for x in uniq[i+1:]]) | |
| if minVal > newMin: | |
| minVal = newMin | |
| return minVal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment