leetcode801 - 使得序列递增的最小交换
一、题目描述
二、ruby方案
| [‘1’,’2’,’3’,’1’].sort{ | x, y | x + y <=> y + x} |
| nums.map(&:to_s).sort{ | x1, x2 | x1 + x2 <=> x2 + x1} |
Show Disqus Comments
| [‘1’,’2’,’3’,’1’].sort{ | x, y | x + y <=> y + x} |
| nums.map(&:to_s).sort{ | x1, x2 | x1 + x2 <=> x2 + x1} |