```
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
n=len(nums)
mn=[['' for i in range(n)] for j in range(n)]
for i in range(n):
mn[i][i]=str(nums[i])
for k in range(1,n):
for i in range(n-k):
x1=max(mn[i][i]+mn[i+1][i+k],mn[i+1][i+k]+mn[i][i])
x2=max(mn[i][i+k-1]+mn[i+k][i+k],mn[i+k][i+k]+mn[i][i+k-1])
x=max(x1,x2)
for j in range(i+1,i+k):
x=max(x,mn[i][j]+mn[j+1][i+k],mn[j+1][i+k]+mn[i][j])
mn[i][i+k]=x
return mn[0][n-1]
```