Find missing number in another array which is shuffled copy | Returns the missing number Size of arr2 [ ] is n - 1 ; missing number 'mnum ; 1 st array is of size 'n ; 2 nd array is of size 'n - 1 ; Required missing number ; Driver Code
def missingNumber ( arr1 , arr2 , n ) : NEW_LINE ' NEW_LINE INDENT mnum = 0 NEW_LINE DEDENT ' NEW_LINE INDENT for i in range ( n ) : NEW_LINE INDENT mnum = mnum ^ arr1 [ i ] NEW_LINE DEDENT DEDENT ' NEW_LINE INDENT for i in range ( n - 1 ) : NEW_LINE INDENT mnum = mnum ^ arr2 [ i ] NEW_LINE DEDENT return mnum NEW_LINE DEDENT arr1 = [ 4 , 8 , 1 , 3 , 7 ] NEW_LINE arr2 = [ 7 , 4 , 3 , 1 ] NEW_LINE n = len ( arr1 ) NEW_LINE print ( " Missing ▁ number ▁ = ▁ " , missingNumber ( arr1 , arr2 , n ) ) NEW_LINE