Poor testcase set and so is the reference answer


  • 0

    Try this : [1,5,11,3].
    I don't think the answer is "true".

    I guess the reference answer allows the element to be used for multiple times, just like the coin change problem(see https://leetcode.com/problems/coin-change/).

    Besides, backtracking without memorization is in exponential complexity if I've not mistaken, so I thought it would face performance downgrade. However it seems backtracking even outperforms dynamic programming on the given evaluation. IMHO maybe it is better for the evaluation to appreciate the effort of dynamic programming & DFS with memorization even if the input size is bounded by 100.


Log in to reply
 

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