You are given an array of integers that may contain duplicates and a target value target. Your task is to find all unique combinations where the chosen numbers sum to the target.
Example 1
Input: arr[] = [3], target = 3
Output: [3]
Explanation: The single element itself equals the target.
Example 2
Input: arr[] = [1 1 2 5], target = 3
Output: [1 2]
Explanation: Elements are chosen once, and duplicate combinations are avoided.
Example 3
Input: arr[] = [10 1 2 7 6 1 5], target = 8
Output: [1 1 6] [1 2 5] [1 7] [2 6]
Explanation: Different unique selections of numbers add up to 8, and repeated combinations are not included.
Sign in to write, run, and submit your solution against the full test suite.