You are viewing a single comment's thread. Return to all comments →
def pickingNumbers(a): se=list(set(a)) maxi=-99 for i in se: ma=0 ma=a.count(i)+max(a.count(i-1),a.count(i+1)) maxi=max(ma,maxi) return maxi
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
def pickingNumbers(a): se=list(set(a)) maxi=-99 for i in se: ma=0 ma=a.count(i)+max(a.count(i-1),a.count(i+1)) maxi=max(ma,maxi) return maxi