LONGEST DUPLICATE SUBSTRING

QUESTION:(LINK:https://leetcode.com/explore/featured/card/june-leetcoding-challenge/541/week-3-june-15th-june-21st/3365/)

Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrences may overlap.)

Return any duplicated substring that has the longest possible length. (If S does not have a duplicated substring, the answer is “”.)

sOLUTION:

i want to ask like while multiplying the ascii value to the power, why are we using s[i]-‘a’+1??
Like,isn’t it that ascii value of a character in a string can simply be taken using s[i]…why are we subtacting with’a’

and while calcluating hash for further substring in O(1) time,in dividing the number by the prime number chosen why are we doing hash=(hash%prime*3%prime)%prime;…how come this signfies division?

and how is binary search helping in this?

Hey it is done to change ascii to normal convention ie ‘a’=1,‘b’=2 and so on
So,we subtract ‘a’