Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_permutations(arr):
- # Write your code here
- result=[]
- def helper(remaining,slate):
- if(len(remaining)==0):
- result.append(list(slate))
- return
- for i in range(len(remaining)):
- slate.append(remaining[i])
- helper(remaining[:i] + remaining[i+1:], slate)
- slate.remove(remaining[i])
- helper(arr,[])
- return result
- print(get_permutations(["A","B","C"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement