title: bottom-up minimal-change algorithm issue
body: <p>Im trying to get all the permutations of the number 4 so like 1,12,21,123,132,...1234,1243,1423,4123,...ect (there are 24) and we have to use the  bottom-up minimal-change algrothem but in my code when it should be moving on it gets stuck at 1,2 and 2,1 sooo i was wondering if anyone could help. My code is a method that you call and give a number then it should give you back a list of all the permutations. All the print statments where for debugging so in the end they wont be there. Any help would be amazing! Thanks</p>
  
  <pre class="lang-py prettyprint-override"><code>def min_change(num):
      end=[]
      A=[]
      for i in range(1,num):
          A.append(i)
          print("appened i",A)
          end.append(A)
  
          for j in end:
              print("entered j",j)
              if len(j)==i:
                  print("made past if")
                  if len(j)!=1:             
                      x=len(j)-1
                      while x&gt;0:
                          print("this is x ",x)
                          B=A
                          end.append(B)
                          temp=B[x-1]
                          B[x-1]=B[x]
                          B[x]=temp
                          print(B)
                          x=x-1
  
      return end 
  </code></pre>