--------------080109010302080302060108
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Hello,

this is my little solution. I created a second one, that's faster than
this, but it looks like C, so I don't post it.

IMHO a cleaner code is more valuable than .3s difference when processing
1M arrays. That doesn't mean my code is clean.

Someone in #ruby-de @ freenode made a similar but nicer code, maybe I
convince him to submit his solution too.

Happy Quizzing
Robert

--------------080109010302080302060108
Content-Type: application/x-ruby;
 name
ayrange.rb"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename
ayrange.rb"

Y2xhc3MgRGF5UmFuZ2UNCiAgZGVmIGluaXRpYWxpemUgZGF5X2xpc3QsIGRheV9sYWJlbHMg
PSAld3tNbyBEaSBNaSBEbyBGciBTYSBTb30NCiAgICByYWlzZSAnbmVlZCBudW0oMS03KSBh
cnJheScgdW5sZXNzIGRheV9saXN0LmlzX2E/IEFycmF5IGFuZA0KICAgIGRheV9saXN0LmFs
bD97IHxufCAoMS4uNykgPT09IG4udG9faSB9DQogICAgQGRheV9saXN0ICAgPSBkYXlfbGlz
dC5tYXAgICB7IHxudW18IG51bS50b19pIH0udW5pcS5zb3J0DQoNCiAgICByYWlzZSAnbmVl
ZCBhcnJheSBvZiBzZXZlbiBkYXkgbGFiZWxzJyB1bmxlc3MgZGF5X2xhYmVscy5pc19hPyBB
cnJheSBhbmQNCiAgICBkYXlfbGFiZWxzLnNpemUgPT0gNw0KICAgIEBkYXlfbGFiZWxzID0g
ZGF5X2xhYmVscy5tYXAgeyB8ZGF5X2xhYmVsfCBkYXlfbGFiZWwudG9fcyB9DQogIGVuZA0K
DQogIGRlZiB0b19zDQogICAgcmVzdWx0ICAgICAgICA9IEFycmF5Lm5ldw0KICAgIGN1cnJl
bnRfcmFuZ2UgPSBbQGRheV9saXN0LmZpcnN0XQ0KDQogICAgKEBkYXlfbGlzdFsxLi4tMV0g
KyBbbmlsXSkuZWFjaCBkbyB8ZGF5fA0KICAgICAgaWYgZGF5ID09IGN1cnJlbnRfcmFuZ2Uu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