bench-rejected-impls/01_report_repair.rb
# Straightforward. But we can do better.
Straightforward. But we can do better.
Straightforward . But we can do better .
def find_by_combination(input, _)
  [2, 3].map { |sz|
    input.combination(sz).filter_map { |xs|
      xs.reduce(:*) if xs.sum == 2020
    }
  }
end
def find_by_combination ( input , _ ) [ 2 , 3 ] . map { | sz | input . combination ( sz ) . filter_map { | xs | xs . reduce ( :* ) if xs . sum == 2020 } } end
Straightforward.
Straightforward .
input
<not_specific>
_
<not_specific>