How can i solve this problem?

i have got no idea on how i could solve this problem.can u help me with the approach

Hi @neha_153

You can start taking arrays elements from left to right and multiply them and compare them with a variable max which will be storing the maximum element of the array initially. If we encounter 0, then we update pro variable to 1. Then we do the same for the reversed array. And print the final result. As this is a greedy approach, we need to check for the reversed array also.

Link : https://ide.codingblocks.com/s/215667
Hope it Helps.

oh.yeah this is indded the best approach i have seen till now.thanks for helping me