Divisible Sum Pairs

  • + 0 comments

    I belive so far this is the most simple to understand PYTHON solution without the use of any fancy functions but just if else and loops.

    sets=[]
    
    for i in range(len(ar)):
        for j in range(len(ar)):
            if i<j:
                if (ar[i]+ar[j])%k==0:
                    sets.append((ar[i],ar[j]))
    return len(sets)