Merge Names


PHP Arrays Public New

Easy  

10min


Implement the unique_names function. When passed two arrays of names, it will return an array containing the names that appear in either or both arrays. The returned array should have no duplicates.

For example, calling MergeNames::unique_names(['Ava', 'Emma', 'Olivia'], ['Olivia', 'Sophia', 'Emma']) should return ['Emma', 'Olivia', 'Ava', 'Sophia'] in any order.

PHP 7.1.9
   

  •   Example case: Wrong answer
  •   Each array has distinct names: Wrong answer
  •   Each array has duplicate names: Wrong answer
  •   Arrays have some names in common: Wrong answer