Fall for code 3.0 (FInd Duplicates)

Can anyone help me with this question as why my code is giving wrong answer.

code link

Logic :- I have hashed the indices at which a particular lowercase character is present for all 26 lowercase characters, and then for the query using lower_bound to find if the characted occurs more than one time in a range and based on that calculating my answer

1 Like

For the query of type 1, You should also modify the string.

1 Like

Yes for the query of first kind, I am deleting the index from the previous character’s vector and inserting it in new character’s vector

I mean make an assignment s[b] = c. So that when there is update query over same index, you erase the correct character

1 Like

Oh yes !!! , completely overlooked it, thanks :smiley: