title: Listing all permutations of a string/integer
body: <p>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.</p>
  
  <p>Is there an example of how this is done and the logic behind solving such a problem?</p>
  
  <p>I've seen a few code snippets but they weren't well commented/explained and thus hard to follow.</p>