a = ["A", "B", "C", "B", "A"]
a.detect{ |e| a.count(e) > 1 }
Created
November 1, 2019 10:12
-
-
Save SunDi3yansyah/81dcdbbfd6ce5776796203ae9b3713c1 to your computer and use it in GitHub Desktop.
Ruby: How to find and return a duplicate value in array?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment