You are viewing a single comment's thread. Return to all comments →
Python solution
def pickingNumbers(a): a = sorted(a) ans = 2 temp = 0 benchmark = a[0] for num in a: if abs(num-benchmark) <= 1: temp += 1 else: ans = temp if temp > ans else ans temp = 1 benchmark = num return ans if temp < ans else temp
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 →
Python solution