You are viewing a single comment's thread. Return to all comments →
def pickingNumbers(a): # Write your code here
a.sort() max_count = 0 count = 1 n = 0 for i in range(1, len(a)): abs_diff = abs(a[n] - a[i]) if (abs_diff <= 1): count += 1 if (abs_diff > 1): n = i count = 1 if (max_count < count): max_count = count return max_count
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
def pickingNumbers(a): # Write your code here