3-Line python code


#1
class Solution:
# @param A : tuple of integers
# @return a strings
def largestNumber(self, A):
    if all(A) == 0: return 0
    from functools import cmp_to_key as cmp
    return "".join(str(x) for x in sorted(A, key=cmp(lambda x, y: 1 if int(str(x)+str(y))>=int(str(y)+str(x)) else -1), reverse=True))

Useful link to pass custom compare function to sorted in python.
Link1 and Link2.


#2

haa line 3 hain pr method ekdum naaaaiiiive aur galat.
should use 2 pointer approach and no auxiliary space.