- Arrays, Searching, Sorting

Find the missing value from Array B formed by adding some value X to Array A

def findHiddenMissing(arr1, arr2, N):            arr1.sort()    arr2.sort()        mp = {}            for i in range(0, N – 1):                                                               a = arr2[i] – arr1[i]                                b = arr2[i] – arr1[i + 1]                if (a != b):                                    if (a > 0):                if not a in mp:                    mp[a] = 1                else:                    mp[a] += 1                                if (b > 0):                if not b in mp:                    mp[b] = 1                else:                    mp[b] += 1                        else:                                    if (a > 0):                if not a in mp:                    mp[a] = 1                else:                    mp[a] += 1            hidden = 0            for it in mp:        if (mp[it] == N – 1):            hidden = it            print(“Hidden:”, end=” “)            print(it)            break            for i in range(0, N):        if (arr1[i] + hidden != arr2[i]):            print(“Missing:”, end=” “)            print(arr1[i])            breakif __name__ == “__main__”:    arr1 = [3, 6, 5, 10]    arr2 = [17, 10, 13]    N = len(arr1)    findHiddenMissing(arr1, arr2, N)