arr
is array of strings:
["hello", "world", "stack", "overflow", "hello", "again"]
What would be an easy and elegant way to check if arr
has duplicates, and if so, return one of them (no matter which)?
Examples:
["A", "B", "C", "B", "A"] # => "A" or "B"
["A", "B", "C"] # => nil