Hi,
I’m trying to solve this problem and realized that the latest solution differs from the old revision of the book. The link is here :https://github.com/adnanaziz/EPIJudge/blob/master/epi_judge_cpp_solutions/substring_match.cc#L39
The latest revision removes the mod operation while the older book ( I have a 2014 print verison) has mod operation and even checks
t_hash -= t[i - size(s)] * power_s;
if (t_hash < 0)
t_hash += kMod;
I think the mod operation will guarantee the hash lying in certain range. But why the latest solution removes the mod? Is it possible to run into overflow situation if I choose a big base?
Thank you!