GUVI
Back

Test case Issue - Numbers-19. Actual and Expected Output are matching.

Created 3 years ago
57 Views
1 Comments
Pratyaksh
@Pratyaksh
Pratyaksh
@PratyakshProfile is locked. Login
from itertools import combinations
n=int(input())
a= list(map(int,input().split()))
p = list(combinations(a,n//2))
f=[]
# print(p[0])
x=''
for i in a:
  x+=str(i)
s=int(x)
for j in p:
  x=''
  for i in j:
    x+=str(i)
  x=x+x[::-1]
  if(int(x)>s):
    f.append(int(x))
f=sorted(f)
print(f[0],end='')

Comments
Please login to comment.
 
Powered by habitate.io Habitate