Online Python Compiler (Interpreter) - Programiz

PHOTO EMBED

Tue Jan 21 2025 12:36:06 GMT+0000 (Coordinated Universal Time)

Saved by @Narendra

def duplibit(arr):
    freq = {}
    dup = []
    for num in arr:
        freq[num] = freq.get(num ,0)+1
    for key,value in freq.items():
        if value >1:
            dup.append(key)
    return dup
        

array = [1,2,3,4,1,2,4,8,9]
print(duplibit(array))
content_copyCOPY

https://www.programiz.com/python-programming/online-compiler/