Title / Description
Code def find_smallest array1, array2 min = Float::INFINITY array1.each_with_index { |elem1,i| array2.each_with_index{ |elem2, j| diff = (elem1 - elem2).abs min = diff unless diff > min } } min end puts find_smallest array1, array2 # 57
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code