If the target =1,it want to get exactly one solution,the result is 0 or 2?


  • 0
    B

    [-2,0,2,-3,5] target=1 It shows the expected answer is 0.

    -2 + 0 +2 =0

    -3 + 0 + 5 =2

    but [-2,0,0,0,4] It shows 2 is the expected answer.

    0 + 0 + 0=0

    -2 + 0 + 4 =2

    Which is the right answer?


  • 0

    All of those answers are valid, the only invalid thing here is those inputs.


Log in to reply
 

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