Space Complexity problem


I solved it using O(n) time complexity however I realised that only the [i-1]th position determines the max min product so I used a tracker variable instead of whole array. But I got my wrong answer for some test cases. If anyone faced similar issue do let me know.