**This is output**

[[3, 2, 2, 3], [5, 2, 3], [3, 4, 3], [7, 3], [5, 2, 3], [3, 5, 2], [3, 7], [3, 5, 2]]

**This i want**

[[3, 7], [3, 2, 5], [3, 4, 3], [3, 2, 2, 3]]

like: [[3,7], [7,3]] → sum of the element in both subsets is 10 but i want only one of them [3,7] or [7,3] in my output.*

```
defmodule Test do
@moduledoc false
def possible_subsets(list, sum) do
list
|> subsets()
|> Enum.filter(&(Enum.sum(&1) == sum))
end
defp subsets([]), do: [[]]
defp subsets([h | t]) do
t
|> subsets()
|> Enum.flat_map(&[[h | &1], &1])
end
end
```