Get Subsequences Doubts

1 String ros = str.substring(1); ( when str = “c” ) doesn’t returns " " instead it returns “”.
2 for(int i = 0 ; i< recResult.size(); i++)
{
myResult.add(recResult.get(i));
recResult.add(cc+recResult.get(i));

	}

when recResult is Returned for first time value in it = [" “]
when c +” " it gives "c " , so there will be an extra space in every subsequence .
Btw I’m getting Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.(Unknown Source)
at java.lang.StringBuilder.toString(Unknown Source)
at Recursion.RecursionContinued.getSS(RecursionContinued.java:27)
at Recursion.RecursionContinued.getSS(RecursionContinued.java:23)
at Recursion.RecursionContinued.getSS(RecursionContinued.java:23)
at Recursion.RecursionContinued.main(RecursionContinued.java:9)

code :https://ide.codingblocks.com/s/111454

@ranaabhinav50
Please provide your complete code.

Please let me know of any errors in the code .

@ranaabhinav50
I completely went through your code you have to add current char(cc)+recResult.get(i) in myResult,not in recResult.

Reason:As recResult is the recursion result and myResult is the Result formed at each level,we need to add everything in myResult,so that we are able to return it to next recursive call.