Change the same index places only to find the min and max



Problem to find minimum and maximum value by changing the same index only.



Example-1:


Input    : n1 = 53792  n2 = 95367
Output   : 53362 95797 
Explain  : minimum = 53362  maximum = 95797


Example-2:


Input    : n1 = 573 n2 = 925
Output   : 523 975
Explain  : minimum = 523  maximum = 975  







Solution




n1 = 53792

n2 = 95367

n1 = [int(x) for x in str(n1)]

n2 = [int(y) for y in str(n2)]

l = []

minimum = ""

maximum = ""

for i in range(len(n1)):

    l.append(n1[i])

    l.append(n2[i])

    minimum += str(min(l))

    maximum += str(max(l))

    l = []

print(minimum,maximum)



Output



53362 95797