How would you find all the integer(excluding negative) combinations of a given number without a given set of numbers? I would imagine it most similar to finding solutions to a stars and bars problem.
For example,
- Find all combinations of 3 numbers that sum to 3
- Result: (0,0,3) (0,1,2) (0,2,1) (0,3,0) (1,0,2) (1,1,1) (1,2,0) (2,0,1) (2,1,0) (3,0,0)
I found something similar implemented in Python. Is it possible to do this in Java? General bars and stars