Sponsored
Use these hints if you're stuck. Try solving on your own first.
Generate all combinations as a preprocessing.
Use bit masking to generate all the combinations.
Solve with full IDE support and test cases