A common task in programming interviews (not from my experience of interviews though) is to take a string or an integer and list every possible permutation.
Is there
Here's a good article covering three algorithms for finding all permutations, including one to find the next permutation.
http://www.cut-the-knot.org/do_you_know/AllPerm.shtml
C++ and Python have built-in next_permutation and itertools.permutations functions respectively.