Find All Duplicates

Find all elements that appear more than once in an array using frequency counting.

Code

Algorithms
arr.tally.select { |_, v| v > 1 }.keys

Parameters

Array to check

Server

More Ruby Snippets