What is the test case 2 of ASCII Subsequences Problem?
Ascii Subsequences
Hy Rishabh,
We cant simply tell you the test case of any problem as they are for their practice.
You can raise your doubt with your code or you doubt and we will reply you shortly also you might be missing any corner case so give it another shot , you will definitely crack it otherwise we are here to help
Thanks And Regards
Actually my test case 2 is getting cleared and in remaining test cases i am getting wrong answer so is the order of my output also matters.
import java.util.*;
public class Main {
public static ArrayList<String> getSS(String str){
if(str.length()==0){
ArrayList<String> base=new ArrayList<String>();
base.add(" ");
return base;
}
char cc=str.charAt(0);
String ros=str.substring(1);
ArrayList<String> result=new ArrayList<String>();
ArrayList<String> recresult=getSS(ros);
for(int i=0;i<recresult.size();i++){
result.add(recresult.get(i));
result.add(cc+recresult.get(i));
result.add((int)cc+recresult.get(i));
}
return result;
}
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
//int n=sc.nextInt();
//for(int j=0;j<n;j++){
String s=sc.next();
ArrayList<String> m=getSS(s);
//Collections.sort(m);
System.out.print(m.size()+" ");
for(int i=0;i<m.size();i++){
System.out.print(m.get(i));
}
//System.out.println();
}
//}
}