Permutations II

Medium

Company Tags

You are given an array nums, that might contain duplicates , return all possible unique permutations in any order.

Example 1:

Input: nums = [1,1,2]

Output: [
    [1,1,2],
    [1,2,1],
    [2,1,1]
]

Example 2:

Input: nums= [2,2]

Output: [[2,2]]

Constraints:

  • 1 <= nums.length <= 8
  • -10 <= nums[i] <= 10


Company Tags

Please upgrade to NeetCode Pro to view company tags.

nums =