Why the test case expects 0:


  • 0
    L

    Input: [-2,0,-1]
    Output: 2
    Expected: 0

    should it be 2?


  • 0
    V

    Maximum product must be in the contiguous sub array within the input array; -2 and -1 are not contiguous as 0 is there in between hence the maximum product is 0, which is contiguous sub array of size 1.


Log in to reply
 

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