In this HackerEarth Sagar's Gift problem solution Today is Sagar's birthday. He got an array of numbers as a gift from his father. His father told him that he has another gift if Sagar is able to make the largest number by concatenating the numbers and swapping the digits of numbers. Help Sagar to make the largest number from the given numbers.


HackerEarth Sagar's Gift problem solution


HackerEarth Sagar's Gift problem solution.

t=int(input())

for _ in range(t):

n=int(input())

a=input().split()

number="".join(a)

numList = [int(digit) for digit in str(number)]

numList=sorted(numList,reverse=True)

s = [str(i) for i in numList]

res = int("".join(s))

print(res)