Ad
Code
Diff
  • def twin_sum_solutions(array)
      duplicates = []
      find_duplicates(array).map{|e| e*2 }
    end
    
    def find_duplicates(array)
      duplicates = []
      array.each do |element|
        duplicates << element if array.count(element) > 1
      end
      duplicates.uniq
    end
    • def twin_sum_solutions(array)
    • duplicates = []
    • find_duplicates(array).map{|e| e*2 }
    • end
    • def find_duplicates(array)
    • duplicates = []
    • array.each do |element|
    • duplicates << element if array.count(element) > 1
    • end
    • duplicates.uniq
    • end