Box SWE Interview Question 2024 April | Backtracking | on-campus

Question · Posted Jun 2026

Question 1: Subsets II Problem Statement Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Constraints 1 <= nums.length <= 10 -10 <= nums[i] <= 10 Examples Example 1: Input: nums = [1,2,2] Output: [[],[1],[1,2],[1,2,2],[2],[2,2]] Explanation 1: Since 2 is duplicated, the algorithm avoids creating duplicate subsets like [1,2] (from the second 2) and [2] (from the second 2). ...

The full answer & interview discussion are available to premium members.

Log in Create a free account