cur to 0 and pk to 1 (which will represent p^k modulo m).s from the end to the beginning.cur to be the rolling hash of the current window of size k.k, multiply pk by p modulo m.k, subtract the contribution of the character that is leaving the window, making sure to add m before taking modulo to avoid negative values.cur equals hashValue, store the current starting index of the substring.k.