Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # We have four scores, two of them share the second place. This means the last
- # one has to be pushed to the fourth place.
- scores = [10, 9, 9, 8]
- ranking, last_score, add = 0, 0, 1
- rankings = scores.map do |score|
- scores.index(score) + 1
- end
- puts scores.inspect # => [10, 9, 9, 8]
- puts rankings.inspect # => [1, 2, 2, 4]
Add Comment
Please, Sign In to add comment