Shortest Palindrome | String Pattern matching DSA | LeetCode 214 in java | Rolling Hash Algorithm

preview_player
Показать описание

we are given a string s. You can convert s to a palindrome by adding characters in front of it.

Return the shortest palindrome you can find by performing this transformation.

My Approach is very simple, i am first finding the longest prefix which is also a palindrome then i am getting the reverse of the remaining part of the string and appending it at the front of the original string.

my approach here is Rolling based hashing algorithm also known as Rolling Hash algorithm.

DSA Algorithms :-
Design HLD:-

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview #interviewtips
#interviewpreparation #interview_ds_algo #hinglish
Рекомендации по теме
Комментарии
Автор

it is working, yes !! but i wanted to know the intuition behind the forward hash and reverse hash, or is it the standard template to check for palindrome using rabin karp ?

ANKIT-moov
join shbcf.ru