Significance of adding $ ->--->$ helps us because lps function calculates longest proper prefix which means if complete string is a palindrome the lps.back() will always be one less than length of the string but adding a $ fixes that
@majidshaikh5913 Жыл бұрын
Deep Dive Explaination. Great Work!
@swagatochakraborty6043 Жыл бұрын
Anyone wondering why $ has been added? Try doing the dry run for this test case with and without adding $ s = "aaaa"