return the smallest possible join from array javascript
问题 I have this code which works good for this array: ['45', '30', '50', '1']. function penalty(a_list) { return a_list.sort((a, b) => a - b).join(''); } for example: given that a_list is ['45', '30', '50', '1'] the smallest possible string will be '1304550' which is right, but what if a_list is ['32', '3'] given this current code I will get '332' which is not correct because '323' is the smallest possible string. Hope that helps. 回答1: You could take the concatinated values of a and b and the