Selecting the triplets such that all array elements can be made equal to arr [ N - 1 ]
for ( let i = 0 ; i < N - 3 ; i += 2 ) { document . write ( i + " " + ( i + 1 ) + " " + ( N - 1 ) + " " ) ; } } else {