Here is the implementation:
function largestNumber(nums):
strs = convert nums to strings
sort strs with comparator:
compare(a, b): return (b + a) compared to (a + b)
if strs[0] == "0":
return "0"
return join(strs, "")
The edge case check handles inputs like [0, 0] which should return "0" not "00".
Sorting takes comparisons. Each comparison is where is digit count. Total: time.