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
< ? php function missingNumber ( $ arr1 , $ arr2 , $ n ) { $ mnum = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ mnum = $ mnum ^ $ arr1 [ $ i ] ; for ( $ i = 0 ; $ i < $ n - 1 ; $ i ++ ) $ mnum = $ mnum ^ $ arr2 [ $ i ] ; return $ mnum ; } $ arr1 = array ( 4 , 8 , 1 , 3 , 7 ) ; $ arr2 = array ( 7 , 4 , 3 , 1 ) ; $ n = count ( $ arr1 ) ; echo " Missing ▁ number ▁ = ▁ " , missingNumber ( $ arr1 , $ arr2 , $ n ) ; ? >