Advertisement
rishu110067

Untitled

Feb 4th, 2022 (edited)
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. results = set()
  2. def helper(slate, arr):
  3.     if len(arr) ==0:
  4.         results.add(tuple(slate))
  5.     else:
  6.         for i in range(len(arr)):
  7.             helper(slate+[arr[i]] ,arr[:i]+arr[i+1:])
  8.     return results
  9.          
  10. def get_permutations(arr):
  11.     helper([],arr)
  12.     return list(results)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement