title: Python More efficient permutation
body: <p>I have a string that consists of x amount of the letter 'r' and y amount of 'u'. And my goal is two print all possible combinations of that same amount of x,y with different orders. This my example of a working code.</p>
  <pre><code>import itertools
  RIGHT = 'r'
  UP = 'u'
  def up_and_right(n, k, lst):
      case = RIGHT*n + UP*k
      return [''.join(p) for p in set(itertools.permutations(case))]
  </code></pre>
  <p>Example input and output:</p>
  <pre><code>input:
  lst1 = []
  up_and_right(2,2,lst1)
  lst1 =&gt; output:['ruru', 'urur', 'rruu', 'uurr', 'urru', 'ruur']
  </code></pre>
  <p>My problem is when the input is an integer more than 10 the code takes a minute to compute. How can I improve the compute time?
  Thanks in advance!</p>