Common Names


C++ Arrays Public New

Easy 

10min


Implement the find_common method. When passed two vectors of names, it will return a vector containing the names that appear in either or both vectors. The returned vector should have no duplicates.

For example, calling CommonNames::findCommon(std::vector<std::string>{"Ava", "Emma", "Olivia"}, std::vector<std::string>{"Olivia", "Sophia", "Emma"}) should return a vector containing Ava, Emma, Olivia, and Sophia in any order.

C++14
   

  •   Example case: Exception
  •   Each vector has distinct names: Exception
  •   Each vector has duplicate names: Exception
  •   Vectors have some names in common: Exception