Largest Number - Implementation

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 O(nlogn)O(n \log n) comparisons. Each comparison is O(k)O(k) where kk is digit count. Total: O(nklogn)O(nk \log n) time.