[Help] Handle hash collision or not when Using Rabin-Karp

I was practicng on Rolling-Hash on string. When I checked out the following two problems:

The solutions both mention about using rolling-hash to optimize the string calcualtion. But One of them handles hash-collision, the other does not.

So I am confused about the criteria of handling hash-collision.

Thanks for your help.

Comments (3)