Adding frequency of elements of suffix to hash for subarray starting from first index There is no prefix for this sub array
for ( let i = k ; i < n ; i ++ ) m . set ( a [ i ] , m . get ( a [ i ] ) == null ? 1 : m . get ( a [ i ] ) + 1 ) ;