another passing solution without using coerce or spaceship operator, using sort_by method in the loop. PASSSSIIINNNGGGGGG