import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static String canConstruct(int[] a) { String str=arrtostr(a); ArrayList res=getpermu(str); if(check(res)==true) { return "Yes"; }else return "No"; } public static ArrayList getpermu(String str) { if (str.length() == 0) { ArrayList baseResult = new ArrayList<>(); baseResult.add(""); return baseResult; } char cc = str.charAt(0); String ros = str.substring(1); ArrayList recResult = getpermu(ros); ArrayList myResult = new ArrayList<>(); for (int i = 0; i < recResult.size(); i++) { String recString = recResult.get(i); for (int j = 0; j <= recString.length(); j++) { String myString = recString.substring(0, j) + cc + recString.substring(j); myResult.add(myString); } } return myResult; } public static String arrtostr(int [] arr) { String str=""; for(int i=0;i list){ int size=list.size(); boolean flag=false; for(int i=0;i