Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The product of elements in a subarray is even if it contains at least one even element.
Iterate from left to right and save the last index of an even number. Let that saved index be “j”.
It can be seen that every subarray starting from earlier than index “j” and ending at the current index has an even product.