num_solve.rb
# Picks all pair combos from numbers to pick_op
Picks all pair combos from numbers to pick_op
Picks all pair combos from numbers to pick_op
def pick_two (numbers, answer, solution)
  return if numbers.length < 2 
  for i in 0..numbers.length-1
    for j in i+1..numbers.length-1
      remaining = numbers.clone 
      b = remaining.delete_at(j) 
      a = remaining.delete_at(i)
      pick_op([a,b].max, [a,b].min, remaining, answer, solution)
    end
  end  
end
def pick_two ( numbers , answer , solution ) return if numbers . length < 2 for i in 0 .. numbers . length - 1 for j in i + 1 .. numbers . length - 1 remaining = numbers . clone b = remaining . delete_at ( j ) a = remaining . delete_at ( i ) pick_op ( [ a , b ] . max , [ a , b ] . min , remaining , answer , solution ) end end end
Picks all pair combos from numbers to pick_op
Picks all pair combos from numbers to pick_op
# Terminate if unable to pick #remaining elements #delete j first so i is unaffected # Since answer must be positive, we enforce a > b
numbers
answer
solution