Otherwise , get the value from the map and update left [ i ]
else : NEW_LINE INDENT tmp = map [ arr [ i ] ] ; NEW_LINE left [ i ] = ( tmp . count ) * ( i - tmp . prevIndex ) + left [ tmp . prevIndex ] NEW_LINE map [ arr [ i ] ] = pair ( tmp . count + 1 , i ) ; NEW_LINE DEDENT