editorial for codechef HISTOSIM

need editoiral for codechef problem:HISTOSIM

since replace operation replaces all occurences of a character, therefore, string P and Q will only be historical similar if we can map each character of String P to characters of string Q uniquely and similar for every character of string Q. This can be done in O(|P|) by maintaining two arrays of length 26 and scanning string P and Q and when a character appears first time we map that character in the array and if that character appears again we can match that if the mapped value in other string is same or not.

For implementation, you can refer to my solution : link

1 Like

thnxx Man!!

//