Skip to content

Instantly share code, notes, and snippets.

@s1s1ty
Created August 24, 2018 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1s1ty/96c809a1c22f80ae9c2ed4acdc35584d to your computer and use it in GitHub Desktop.
Save s1s1ty/96c809a1c22f80ae9c2ed4acdc35584d to your computer and use it in GitHub Desktop.
30-days-python-code
class Difference:
def __init__(self, a):
self.__elements = a
self.maximumDifference = -1
def computeDifference(self):
e = self.__elements
m = -1
for i in range(len(e)):
for j in range(i+1, len(e)):
sub = abs(e[i]-e[j])
m = max(sub, m)
self.maximumDifference = m
_ = input()
a = [int(e) for e in input().split(' ')]
d = Difference(a)
d.computeDifference()
print(d.maximumDifference)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment