Skip to content

Instantly share code, notes, and snippets.

@venelrene
Created November 12, 2019 19:27
Show Gist options
  • Select an option

  • Save venelrene/5c5dc2d1bbd72a145dfd56a639fc2c3e to your computer and use it in GitHub Desktop.

Select an option

Save venelrene/5c5dc2d1bbd72a145dfd56a639fc2c3e to your computer and use it in GitHub Desktop.
Given an unsorted array of integers, find the smallest number in the array, the largest number in the array, and the smallest number between the two array bounds that is not in the array.
def min_min_max(array)
(array.minmax << ((array.min..array.max).to_a - array).min).sort
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment