create two auxiliary hash arrays to count frequency of difference , one array for non - negative difference and other array for negative difference . Size of these two auxiliary arrays is ' n + 1' because difference can reach maximum value ' n ' as well as minimum value ' - n '
int hash_positive [ n + 1 ] , hash_negative [ n + 1 ] ;