If curr_power - power already exists in map then we have found a subarray with target power .
if ( map . ContainsKey ( curr_power - power ) ) { Console . WriteLine ( " Substring ▁ from ▁ index ▁ " + ( map [ curr_power - power ] + 1 ) + " ▁ to ▁ " + i + " ▁ has ▁ power ▁ " + power ) ; return ; } if ( ! map . ContainsKey ( curr_power ) ) map . Add ( curr_power , i ) ; else map [ curr_power ] = i ; }