I am a high-school student, relatively new to programming, and am working on a mathematics problem and using java to help me. Anyway, I have run into a problem with memory. I would like to find all the possible combinations of a string without repeats.
For example, given the string 'AABB' I would want 'AABB', 'ABAB', 'ABBA', 'BBAA', 'BABA', and 'BAAB' returned.
There is a similar question asked here: Every combination of character array
The solution provided at this link is in general what I want, however in my case it is unable to handle longer strings. In my specific case I want a method that is able to take a string with 18 characters in it.
Additionally the string which I would like to find all the combinations of, only needs to contain 2 characters; and so, there may be a more efficient way to do it in binary, but I am not sure.
Any help would be greatly appreciated.