Subsequence with its ascii

string =“ab” then it’s subsequence is
["" ,a,97,b,98,ab,a98,97b,9798]
i can able to form the subsequence but i couldn’t able form it with ascii

@17pa1a0277,

If you have written the code for first version, subsequences without ASCII, you just need to modify it little bit.

Only change will be to add one extra recursion call with ASCII code appending in result so far.

	for (int i = 0; i < n; i++) {
		int c = (int) str.charAt(0);
		res.add(c + res.get(i));
	}

Something like this where res is our result arraylist to be returned.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.