Common Names
Ruby
Arrays
Public
New
Ruby
Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. Having a basic familiarity with the programming language used on the job is a prerequisite for quickly getting up to speed.
Arrays
An array is a container of a fixed number of objects of a similar type. It is a fundamental component of most programming languages.
Public
Public questions (free account) are common interview questions. They are great for practicing, or if you want to filter candidates using the classic problems.
New
This is a part of latest question addition to our question library.
Implement the find_common method. 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 CommonNames.find_common(["Ava", "Emma", "Olivia"], ["Olivia", "Sophia", "Emma"]) should return an array containing Ava, Emma, Olivia, and Sophia in any order.
Ruby 2.5.1
- 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