Every distinct ordering
Given a list nums of integers that may contain repeated values, return every distinct ordering of the whole list. Two orderings are the same if they show the same values in the same positions, so [1, 1, 2] has 3 orderings, not 6. Each one must appear exactly once; you may return them in any sequence.
1 ≤ len(nums) ≤ 7, and nums is not necessarily sorted.
Examples
distinct_orderings([1,2,3])→[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]distinct_orderings([1,1,2])→[[1,1,2],[1,2,1],[2,1,1]]distinct_orderings([2,2])→[[2,2]]