import functools

class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums): def comparator(x, y): # inputs are string representations of non-negative ints
if x+y > y+x: # no need to convert to int because x+y and y+x are same length
return - # so lexicographic string sort behaves like numeric sort
else:
return nums = list(map(str, nums)) # convert to strings
nums.sort(key=functools.cmp_to_key(comparator)) return nums
ls=[,,,,,]
x=Solution()
print(x.largestNumber(ls))

输出

['', '', '', '', '', '']
[Program finished]

最新文章

  1. Java 之 数据库编程(JDBC)
  2. linq lamada
  3. Git合并特定commits 到另一个分支
  4. C语言编译链接
  5. C/C++面试小知识点
  6. 简单的背包变形HDU1203,HDU2955
  7. 【转】Java中字符串中子串的查找共有四种方法(indexof())
  8. Ubuntu下Qt项目的部署
  9. Android ImageView 点击更换头像
  10. 拔高课程_day14_课堂笔记
  11. 【Selenium】Selenium1
  12. glog 使用
  13. 3.sass的数据类型与函数
  14. Cocos2D:塔防游戏制作之旅(十五)
  15. Mesos源码分析(15): Test Executor的运行
  16. 【转】vmware的macos中apple ID一直登陆不上解决 ---(伪造smbios设备信息)
  17. F#周报2019年第17期
  18. MySQL索引原理以及类型
  19. ASP.NET Core分布式项目实战-目录
  20. Node + Express + vue2.0 + Webpack项目实践

热门文章

  1. Symfony2 学习笔记之系统路由
  2. [转载]window.location.href的用法(动态输出跳转)
  3. Kattis之旅——Perfect Pth Powers
  4. Spring RestController 请求参数详解
  5. Vue小案例 之 商品管理------添加商品
  6. spring boot mvc系列-静态资源配置与MappingHandler拦截器
  7. mysql读写分离[高可用]
  8. MS11-050安全漏洞
  9. 如何用Tensorflow训练模型成pb文件和和如何加载已经训练好的模型文件
  10. Django使用多数据库