Duplicate Elements

    0

    0

    Aakanksha Priya

    Find out and print duplicate elements in an array

    arr = [7, 4, 5, 0, 7, 8, 0, 3, 2]
    arr_size = len(arr)
    for i in range(arr_size):
        x = arr[i] % arr_size
        arr[x] = arr[x] + arr_size
    print("The repeating elements are : ")
    for i in range(arr_size):
        if (arr[i] >= arr_size*2):
            print(i, " ")
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.