단순

def pickingNumbers(a):    
    m = [0] * 100    
    
    for num in a:
        m[num] += 1

    cnt = 0    
    for i in range(1,n):        
        cnt = max(cnt, m[i - 1] + m[i])
        
    return maxval

복잡

def pickingNumbers(a):
    # Write your code here
    _a = list(set(sorted(a)))
    cnt = -1
    
    subsets = []
    for i in range(len(_a)):
        temp = _a[i]
        subset = [temp]
        
        for j in range(i + 1, len(_a)):
            if abs(temp - _a[j]) <= 1:
                subset.append(_a[j])
                
        subsets.append(subset)
        
    for subset in subsets:
        _sum = 0
        
        for v in subset:
            _sum += a.count(v)
            
        cnt = max(cnt, _sum)
        
    return cnt