Function to return the largest element such that its previous and next element product is maximum
int maxElement ( int a [ ] , int n ) { if ( n < 3 ) return -1 ; int maxElement = a [ 0 ] ; int maxProd = a [ n - 1 ] * a [ 1 ] ; for ( int i = 1 ; i < n ; i ++ ) {