What if only distinct sequences are allowed?

  • 0

    What if the question only allows output of distinct sequences, regardless of order, how does that change the solution? Still DP?

  • 0

    I think DP will still work, but right now I can only think an algorithm running in O(n*target) time and O(n^target) space. I don't know if there is anyway that can reduce the memory cause.

Log in to reply

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