Add arr [ i ] to prefix map
if ( ! prefix_element_count . has ( arr [ i ] ) ) prefix_element_count . set ( arr [ i ] , 1 ) ; else prefix_element_count . set ( arr [ i ] , prefix_element_count . get ( arr [ i ] ) + 1 ) ;