rubyist rubyist - 1 year ago 148
Ruby Question

Find second largest number from an array in Ruby

I have an array

a = [3,6,774,24,56,2,64,56,34]
. I need to find the second largest number in a single iteration using Ruby. How do I achieve it?

Answer Source



And you're done :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download