Well, how would you go about finding these permutations yourself, if you didn’t have the help of a computer program? Let’s think about this with the example of an easy, short word: test. You might start by fixing the beginning of the word in place, and only swapping the remaining letters… t <- fixed, “est” <- how can we swap these letters around to make different words? Notice something here? We now need to find all the permutations of “est” – basically, we need to run the algorithm we were already trying to write, but on est instead of test. We’ve simplified the problem a little by making the word shorter. This is where we’re going to get into something called “recursion,” which is where a function calls itself on a different input until finally the input is so simple that it can figure out what to do with it. But let’s keep talking in pseudocode for now. OK, so finding all the combinations of “est” is still pretty tough, because there’s a bunch of them, 6 I think. So let’s also fix the e in place and find all the combinations of the remaining word. t <- fixed, e <- fixed, “st”. Hey, finding all the combinations of st is pretty easy. There’s only st and ts. This is what we’ll call our base case, which is simple, so we don’t need to call the function again. This is how we avoid getting into an infinite loop during recursion. t e st t e ts So those are all the combinations where t and e are fixed. Now we need to go back up a level to where “t” is the only fixed character, and find the other combinations of “est” that we missed. We found all the ones where e is the first letter, so let’s make s the first letter now. t <- fixed, s <- fixed, “et” Again, “et” is only two letters long, so it triggers our “base case” where we know the only combinations are “et” and “te”. t s et t s te So, turning this into code: if your function signature is String [] string_permutations(the_string), you’ll want to write special case for handling the case where “the_string” is only 2 letters long, which returns an array containing the_string and the_string reversed. If your string isn’t 2 letters long, fix the first letter in place and call string_permutations on the rest of the word. Eventually you’ll reach the case where the rest of the word is only 2 letters long, and then the base case will be triggered. Then, you can swap letters as needed to get the words you missed when you fixed the first characters in place. Finally, eliminate duplicates: our word “test” has two t’s, so there will be some duplicates. Learning how to think with recursion can be tough, but it comes more easily with experience. Keep practicing, you’ll get it.