Sha256: 1a7acb4e05f59dd4ddf9121b06d36af96d39c76b7b9586e62a3771fe38542a46
Contents?: true
Size: 421 Bytes
Versions: 15
Compression:
Stored size: 421 Bytes
Contents
module Eddy module Util # Given an array of numbers, returns the lowest number not included in the array. # # @param existing [Array<Integer>] # @return [Integer] def self.new_number(existing) n = nil i = 1 loop do if existing.include?(i) i += 1 next else n = i break end end return n end end end
Version data entries
15 entries across 15 versions & 1 rubygems