Sorting a hash in ruby based on value and then key

后端 未结 0 1834
迷失自我
迷失自我 2021-02-15 20:02

How do you sort a hash in ruby based on the value and then key? For example

h = {4 => 5, 2 => 5, 7 => 1}

would sort into



        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题