EX_03/level-2/powerset
2025-10-05 17:10:55 +01:00
..
Makefile added level-1 2025-09-23 08:41:21 +01:00
powerset_clean.c Added permutations and powerset 2025-09-30 13:13:09 +00:00
powerset.c Replaced subject resolutions of level-2 with backtracking 2025-09-25 08:16:02 +01:00
README.md Edited README's, added broken_gnl exercise, LICENSE and main README 2025-10-05 17:10:55 +01:00
subject.txt added level-1 2025-09-23 08:41:21 +01:00

Powerset

What is this exercise about?

Imagine you have a bag of numbered balls, and you want to find all the different ways you can pick some balls so that the numbers on them add up to a specific target number.

This is exactly what the powerset exercise does!

Real-world example

Let's say you have these numbered balls: 1, 2, 3, 4, 5

And you want to find all the ways to pick balls that add up to 5.

Here are all the possible ways:

  • Pick just ball 5 → 5 = 5
  • Pick balls 1 and 4 → 1 + 4 = 5
  • Pick balls 2 and 3 → 2 + 3 = 5

So the answer would be:

5
1 4
2 3