I'm trying to create a function that checks if two numbers within an array have a sum of zero.
[1,2,3,4,5] => false
[1,2,3,-2,5] => true
This is what I have so far but I can't figure it out:
def zero_sum?(arr)
arr.each do |num|
arr.each do |num2|
if (num.to_i + num2.to_i) == 0
true
else
false
end
end
end
end