Check the given conditions
if ( i > 0 && i + 1 < N ) { if ( temp [ i ] < temp [ i + 1 ] && temp [ i ] < temp [ i - 1 ] ) { ct ++ ; } } } Console . WriteLine ( " Count ▁ of ▁ triplets : " + ct ) ; Console . Write ( " Array : " ) ; for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( temp [ i ] + " ▁ " ) ; } }