Find pair in subarray A [ i + 1. . n - 1 ] with sum equal to sum - A [ i ]
HashSet < int > s = new HashSet < int > ( ) ; int curr_sum = sum - A [ i ] ; for ( int j = i + 1 ; j < arr_size ; j ++ ) { if ( s . Contains ( curr_sum - A [ j ] ) ) { Console . Write ( " Triplet ▁ is ▁ { 0 } , ▁ { 1 } , ▁ { 2 } " , A [ i ] , A [ j ] , curr_sum - A [ j ] ) ; return true ; } s . Add ( A [ j ] ) ; } }