Backtracking: Count subsets of input indexes whose positive values sum to target. Each index may be used at most once; equal values at different indexes remain distinct choices.
Input: A JSON object { "nums": number[], "target": number }.
Output: A JSON integer subset count.
Constraints:
- 0 <= nums.length <= 24
- Every nums value is a positive integer
- target is a non-negative integer
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: HARD. Variant: 12. Favor a pragmatic solution that is easy to ship, read, and adapt.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked hard difficulty.
The signed-in workspace provides the tools required by the round, such as recording, code execution