DEV Community

Discussion on: Daily Coding Problem #2

Collapse
 
chenge profile image
chenge • Edited
def total(arr)
  arr.reduce { |acc, x| acc * x }
end  

arr = [1, 2, 3, 4, 5]
arr.map { |x| total(arr) / x }