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.
classDifference:def__init__(self,a):self.__elements=aself.maximumDifference=-9999999# Add your code heredefcomputeDifference(self):foriinrange(len(self.__elements)):forjinrange(i+1,len(self.__elements)):ifself.maximumDifference<abs(self.__elements[i]-self.__elements[j]):self.maximumDifference=abs(self.__elements[i]-self.__elements[j])returnself.maximumDifference# End of Difference class_=input()a=[int(e)foreininput().split(' ')]d=Difference(a)d.computeDifference()print(d.maximumDifference)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 14: Scope
You are viewing a single comment's thread. Return to all comments →