how to print and append the ascii value for different characters.
Get Ascii value
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.