Given two arrays of strings, A and B.
B contains every element in A, and has one additional member, for example:
A = ['dog', 'cat', 'monkey]
B = ['cat', 'rat', 'dog', 'monkey']
I need to write a function to find the extra string in B using O(n)
. Please help!
UPDATE: I know the difference can be achieved using PHP in-built function array_diff().