179. Largest Number

the key is this:

sort input [3,30,34,5,9]

to [9, 5, 34, 3, 30]

ex: 34,3 -> 334, 343 compare which one is bigger

need to handle edge case for all zero : ["0", "0", "0"]

Time: O(nlogn)

space: O(n)

Last updated

Was this helpful?