Well, first of all, I'm new to Ruby, and to this forum. So, hello. :)

I've studied the poignant guide and it really has helped me pick up the
language pretty fast. After that, I started solving some coding puzzles
using Ruby. It just helps a lot to get used to the language I feel.

I'm stuck with one such puzzle. I have solved it very easily since it is
pretty straight-forward, but the solution is being rejected (by the host
website) with the error 'Time Exceded'! I know that Ruby cannot compete
with the speed of C/C++ but it
has got to be able to answer a tiny puzzle on a website which accepts
solutions in Ruby?

Here's the link to the puzzle. It's just a normal sorting.
http://www.codechef.com/problems/TSORT/

And this is my solution
array ||= []
gets.to_i.times do
  array << gets
end
puts array.sort

My question is, is there any other way I can achieve high-speed sorting
with Ruby? I'm using the basic Array#sort here, but is there a way to do
it faster (even though it means lot more lines of code)?

Cheers,
Gaurav

-- 
Posted via http://www.ruby-forum.com/.