You are given a list of numbers nums. Some numbers may repeat. Return all the different ways to arrange them in a row (the permutations). A permutation that looks the same as another one is counted once. Return the answer in any order.
Examples
Example 1:
Input: nums = [2,2,3]
Output: [[2,2,3],[2,3,2],[3,2,2]]
Explanation: There are only 3 different rows. The two 2s look the same, so swapping them gives nothing new.
Example 2:
Input: nums = [7,7,7]
Output: [[7,7,7]]
Explanation: All numbers are equal, so there is only one row.
Example 3:
Input: nums = [1,2]
Output: [[1,2],[2,1]]
Explanation: Two different numbers give 2 rows.