Блог пользователя inception_95

Автор inception_95, история, 7 лет назад, По-английски

After watching this video Algorithms Live! Episode 3 — Rolling Hashes and Bloom Filters, I tried to implement pull character from last by myself and applying it on this problem here:

Problem: 1423. String Tale

Code : My code

Is my implementation wrong? if so, what is wrong in this? or can anyone give a code that works like the same principle as the video and works perfectly?

Thanks in advance.

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Problem is, probably, because of this

may contain any ASCII characters with codes from 33 to 255

So for characters with codes more than 127, their char values will be < 0. And you don't take this into account, when you take modulo of products with these values. Just cast all codes into unsigned char before use.