Slide 6
Slide 6 text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
the_fastest_lang.rb faster.cpp
@kalashnikovisme @evilmartians
def sum_eq_n?(arr, n)
return true if arr.empty? && n == 0
arr.product(arr).reject do
|a,b| a == b
end.any? { |a,b| a + b == n }
end
Is this slow?