According to the code given, if max==1 and there is no positive element and there is a zero then return 0 but there can be two or more -1’s which is making the max=1 and the answer should be 1 in that case not zero. The logic used here is wrong.
Maximum product subarray
Yes, you are correct, the code should give incorrect answer for this testcase.