好久没写博客,贡献一份高质量代码。高质量代码其实思路上没什么特别的,只是编程细节上面做了些优化。

        Your runtime beats 96.73% of cppsubmissions!

LargestNumber

Given a list of non negative integers, arrange them such that they form the largest number.

For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.

Note: The result may be very large, so you need to return a string instead of an integer.

        使用贪心算法解决问题,重载sort函数,使用字符串比较实现高位比较,不多说,上代码。

        OK,See You Next Chapter!

发表评论

电子邮件地址不会被公开。 必填项已用*标注