From 548a52570a82ce0dc853af6f800ff6b3dad149a6 Mon Sep 17 00:00:00 2001 From: Aakash Panchal <51417248+Aakash-Panchal27@users.noreply.github.com> Date: Wed, 3 Jun 2020 22:50:01 +0530 Subject: [PATCH] Update String_hashing.md --- articles/Akash Articles/md/String_hashing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/articles/Akash Articles/md/String_hashing.md b/articles/Akash Articles/md/String_hashing.md index 75b63f9..fe1aba9 100644 --- a/articles/Akash Articles/md/String_hashing.md +++ b/articles/Akash Articles/md/String_hashing.md @@ -183,6 +183,8 @@ $O(|p|)$ is required for calculating the hash of the pattern and $O(|s|)$ for co You are given left($l$) and right($r$) indices of a substring, you are required to check whether the given substring is palindrome or not. +We will simply compare hashes of two half parts of substring $s[l,r]$. If hashes are same means that two half parts are same and substring is a palindrome. + If there are many queries of this type, then each query can be answered in $O(1)$, after $O(n)$ preprocessing. ```cpp