setter and tester sir can explain there solutions. Please sir.
i have also used LPS(Prefix sum technique) as setter solution but i did not get it! why @rishup_nitdgp used the (len*2>(i+1)). could you please explain me the little bit!
It is for avoid overlapping. I explained it here:
@pastor Read about gcc compilers and try to find which gcc is your vs code running on. I mostly use ideone but seems like it still doesn’t support c++17. I used code and compile from codechef only.
can you please provide the cpp code by using hashing
For each iteration you are calculating the hashValue in O(n), thus making your overall complexity O(n*n) which will surely timeout. You need to do some preCalculation as you are calculating the same stuff again and again.
Have a look : CodeChef: Practical coding for everyone
in kmp solution of setter why use 2 keys(0,1).is it can using only two 1d-array?
my question is why prefix function is calculated for reverse of array
i found a blog and now on i have c++17 running fine on codeblocks with the same mingw compiler but still no help in vs code i don’t know how to manipulate json in vscode and i guess thats why it is working
Sir can you explain what do you mean by overlapping length ? PLz
Why is this approach of find hash values wrong?
void computehashvalues(string s)
{
int l=s.length(),power=31;
hasharr[0]=(s.at(0)-‘a’+1);
for(int i=1;i<=l-1;i++)
{
hasharr[i]=hasharr[i-1]+((s.at(i)-‘a’+1)power);
power=powerp;
}
}
long long int findHash(int si,int ei)
{
if(si==0)
return hasharr[ei];
else
{
return (hasharr[ei]-hasharr[si])/pow(p,si);
}
}
Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! ![]()
Since u ll be using some value as for modulus so it is quite possible hasharr[ei] < hasharr[si] (after modulus) so in the the findhash function u need to consider mod number as well …
Can plz correct it i am not able to uderstand what corrections do i have to make??
can anyone please tell why time limit is exceeded in my submission.i used the rolling hashing array
and time complexity according to me is O(n) for each test CodeChef: Practical coding for everyone
My code is in cpp
Hi
https://www.codechef.com/viewsolution/33330471
^^ here’s my solution for CHEFSHIP
(problem link: CHEFSHIP Problem - CodeChef)
(submit here: CodeChef: Practical coding for everyone)
![]()
I loved your explanation