I want to make it so that when given "abc" it returns in an ArrayList: "abc" "ab" "a" ""
Right now, I'm trying to do this recursion alone. I've come to sort of have the idea that it's repeating the second line and throwing everything off. Is there any way to fix this to make it work as intended, or do I have a faulty plan and need to rewrite the whole thing?
Wait..Wait Wait..!! Whats this..we are creating the list again..so earlier list will be wiped off..!! Everytime the method is called a new list is created and earlier one lost its existence...!! so instead of that we should get the earlier list and add this string..!! one possible way is to define the list outside the method..and its scope should be such that ..it is accessible with in the method..!!