Define a helper function backtrack that takes the current subset, the starting index, and the nums array.
Add the current subset to the result.
Iterate over the nums array starting from the given index.
If the current element is the same as the previous element and the previous element has not been considered in this recursive call, skip it to avoid duplicates.
Otherwise, add the current element to the current subset and recursively call backtrack with the next index.
Backtrack by removing the last element from the current subset.