Sort the array first. During backtracking, skip an element if it equals the previous element and the previous element hasn't been used yet.
This ensures you don't generate duplicate permutations. The condition: if nums[i] == nums[i-1] and not used[i-1], skip.
Example: [1,1,2]. When picking the second 1, you only do it if the first 1 was already used in the current path.