O66
Permutations II (With Duplicates)
Problem Statement & Objective
Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.
Function Signature (Python)
permute_unique(nums: list[int]) -> list[list[int]]Input & Output Contract
Output Rule:Benzersiz permütasyonlar listesi.
System Constraints
1 <= sayilar.length <= 8
-10 <= sayilar[i] <= 10Example Execution Walkthrough
sayilar = [1, 1, 2] -> [[1, 1, 2], [1, 2, 1], [2, 1, 1]]Example Test Scenarios (3)
Example 1
Input:
[[1,1,2]]Expected Output:
[[1,1,2],[1,2,1],[2,1,1]]Example 2: Benzersizler
Input:
[[1,2,3]]Expected Output:
[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Example 3: Single Element
Input:
[[1]]Expected Output:
[[1]]