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’