lib/hrom512/nmax/max_numbers_finder.rb in hrom512-nmax-0.1.1 vs lib/hrom512/nmax/max_numbers_finder.rb in hrom512-nmax-0.1.2

- old
+ new

@@ -12,22 +12,20 @@ def find numbers_parser = NumbersParser.new(@input_stream) numbers = [] while (number = numbers_parser.next_number) - next if numbers.include?(number) - numbers << number numbers = max_elements(numbers) if numbers.size > MAX_STORE_ELEMENTS end max_elements(numbers) end private def max_elements(numbers) - numbers.sort.reverse[0..(@numbers_count - 1)] + numbers.uniq.sort.reverse[0..(@numbers_count - 1)] end end end end