import java.util.*;


public class Solution {
    /**
     * 最大数
     * @param nums int整型一维数组
     * @return string字符串
     */
    public String solve (int[] nums) {
        // write code here
        if (nums == null || nums.length < 1) {
            return "";
        }
        int n = nums.length;
        String[] strs = new String[n];
        for (int i = 0; i < n; i++) {
            strs[i] = String.valueOf(nums[i]);
        }
        Arrays.sort(strs, (o1, o2) -> (o2 + o1).compareTo(o1 + o2));
        StringBuilder sb = new StringBuilder();
        for (String str : strs) {
            sb.append(str);
        }
        String res = sb.toString();
        int i = 0;
        while (i < res.length() && res.charAt(i) == '0') {
            i++;
        }
        if (i >= res.length()) {
            return "0";
        }
        return i != 0 ? res.substring(i) : res;
    }
}