AMAZON | SDE 2021 | GIFTING GROUPS & ALGORITM SWAP
Anonymous User
2310

Possible Amazon SDE Assessment

# Gifting groups 
def countGroups(related):
    count = 0
    n = len(related)
    for i in range(n):
        print(related)
        if related[i] != True:
            count += 1
            countHelper(related, related[i], n)
    return count
	
# Algoritm Swap
def howManySwaps(arr, n):
    # A temp_arr is created to store
    # sorted array in merge function
    temp_arr = [0]*n
    return _merge_sort(arr, temp_arr, 0, n-1)
Comments (2)