Suppose the input is [1,1,3,4,5] then the following code provided in the soln cannot take care of that. However its not mentioned in the question that the input has no repetition of numbers and also it mentioned that the solution set must not contain duplicate subsets.
they clearly mentioned distinct elements
LOL. I never assumed distinct elements, and used quite a lot of time to figure out how to do their version of non-distinct elements right.
P.S. redone handling only distinct elements. Code is much simpler, but well, the output with non-distinct elements are obviously different from the “Expected Output”.