Adding frequency of elements of suffix to hash for subarray starting from first index There is no prefix for this sub array
for ( int i = k ; i < n ; i ++ ) if ( m . ContainsKey ( a [ i ] ) ) m [ a [ i ] ] = m [ a [ i ] ] + 1 ; else m . Add ( a [ i ] , 1 ) ;