If curr_power - power already exists in map then we have found a subarray with target power .
if ( map . find ( curr_power - power ) != map . end ( ) ) { cout << " Substring ▁ from ▁ index ▁ " << map [ curr_power - power ] + 1 << " ▁ to ▁ " << i << " ▁ has ▁ power ▁ " << power << endl ; return ; } map [ curr_power ] = i ; }