fork download
arr = (1..10).to_a
result = []
0.upto(10) do |i|
	tmp = arr.combination(i).to_a
	tmp.map! { |e| e.sort }
	result += tmp
end
result.sort_by! { |e| [e.length, e] }
# Numeracja tablicy od 0 - szukamy więc elementu o indeksie 899
puts result[899]
Success #stdin #stdout 0s 28352KB
stdin
Standard input is empty
stdout
1
2
5
6
7
8
10