Jump to content

Largest int from concatenated ints: Difference between revisions

→‎Compare repeated string method: change ruby per python change
m (→‎{{header|REXX}}: optimized the search using <<= instead of <<. -- ~~~~)
(→‎Compare repeated string method: change ruby per python change)
Line 364:
<lang ruby>def icsort nums
maxlen = nums.max.to_s.length
nums.map{ |x| x.to_s }.sort_by { |x| x * (maxlen * 2 / x.length + 1) }.reverse
end
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.