Taking the max product from two choices Correspondingly changing the pointer 's position
if ( $ left_product > $ right_product ) { $ product *= $ left_product ; $ i += 2 ; } else { $ product *= $ right_product ; $ j -= 2 ; } }