Given a collection of numbers that might contain duplicates, return all possible unique permutations.
[1,1,2] have the following unique permutations:
[1,1,2] [1,2,1] [2,1,1]
NOTE : No 2 entries in the permutation sequence should be the same.
Warning : DO NOT USE LIBRARY FUNCTION FOR GENERATING PERMUTATIONS.
Example : next_permutations in C++ / itertools.permutations in python.
If you do, we will disqualify your submission retroactively and give you penalty points.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.