What if different sequences of the same numbers are counted as the same combination?


  • 0
    O

    I thought the question was asking how many combinations where the order does not matter.
    For example, if target=5, nums=[2, 3], then the number of combinations should be 1 because (2, 3) and (3, 2) represent the same combination.
    If this is the case, how to solve this problem?


  • 0
    W
    This post is deleted!

  • 0
    A

    @opmiss You can still use DP, but slightly different loops. Think about the coin change problem. To reach an mount, how many combinations (real combinations, not permutations) you can have.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.