Bin given limits: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added intro text)
Line 1,529: Line 1,529:


=={{header|Ruby}}==
=={{header|Ruby}}==
Perform a binary search on the data to select the limit and keep a tally on that.
Perform a binary search on the data to select the limit and keep a tally on that. Makes use of Ruby 3.0 end-less and begin-less Ranges.
<lang ruby>Test = Struct.new(:limits, :data)
<lang ruby>Test = Struct.new(:limits, :data)
tests = Test.new( [23, 37, 43, 53, 67, 83],
tests = Test.new( [23, 37, 43, 53, 67, 83],