Confluent interview question

Similar to LC- Combination Sum