import java.util.ArrayList;

public class Solution {
    public String PrintMinNumber(int [] numbers) {
        
        if (0 == numbers.length) {
            return "";
        }
        if (1 == numbers.length) {
            return "" + numbers[0];
        }
        
        quickSort(numbers, 0, numbers.length - 1);
        StringBuffer sb = new StringBuffer("");
        for (int num : numbers) {
            sb.append(num);
        }
        return new String(sb);
    }
    
    public void quickSort(int[] numbers, int start, int end) {
        if (start >= end) {
            return;
        }
        int l = start - 1;
        int r = end + 1;
        int p = start;
        int val = numbers[end];
        while (p < r) {
            if (whoBig(numbers[p], val) == -1) { // 小于
                int swap = numbers[p];
                numbers[p] = numbers[l + 1];
                numbers[l + 1] = swap;
                l++;
                p++;
            }
            else if (whoBig(numbers[p], val) == 1) { // 大于
                int swap = numbers[p];
                numbers[p] = numbers[r - 1];
                numbers[r - 1] = swap;
                r--;
            }
            else {
                p++;
            }
        }
        quickSort(numbers, start, l);
        quickSort(numbers, r, end);
    }
    
    public int whoBig(int num1, int num2) {
        String str1 = "" + num1 + num2;
        String str2 = "" + num2 + num1;
        for (int i = 0; i < str1.length(); i++) {
            if (str1.charAt(i) < str2.charAt(i)) {
                return -1;
            }
            else if (str1.charAt(i) > str2.charAt(i)) {
                return 1;
            }
        }
        return 0;
    }
}