Skip to content

[47] Permutations II

https://leetcode.com/problems/permutations-ii/description/

  • algorithms
  • Medium (37.83%)
  • Source Code: 47.permutations-ii.py
  • Total Accepted: 233.5K
  • Total Submissions: 585.2K
  • Testcase Example: '[1,1,2]'

Given a collection of numbers that might contain duplicates, return all possible unique permutations.

Example:

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

python
class Solution(object):
    def permuteUnique(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """

Last updated: