Can someone help me understand why this solution gives TLE?


#1
public class Solution {
// DO NOT MODIFY THE LIST. IT IS READ ONLY
public String largestNumber(final List<Integer> A) {
    Collections.sort(A,(a,b)->(String.valueOf(b)+String.valueOf(a))
                                .compareTo((String.valueOf(a)+String.valueOf(b))));
    String res = "";
    for(int i =0;i<A.size();i++){
        res+=String.valueOf(A.get(i));
    }
    if(res.charAt(0)=='0') return "0";
    return res;
}

}