E. Saynatkari wrote:
> 
> Post the code somewhere, there might be room for improvement
> in the algorithm though it will still be considerably slower.

It looks, to me, like he attached his code to the OP.

Regardless, it doesn't matter.  Algorithmic improvements may help both 
the C++ and Ruby versions - but it's not going to change the fact that 
one is a relatively low-level language, compiled to native machine code, 
and the other is an interpreted dynamic language.  To compare them is 
either ridiculous, or more likely in this case, simply ignorant.

--Steve