Longest Common Subpath ( Leetcode , Binary Search + Rolling Hash ) [Solved]

Question : https://leetcode.com/contest/weekly-contest-248/problems/longest-common-subpath/

I m trying above question , by using double hash and binary search , and getting Runtime error , I m not able to find any error please help
, Here is my code - >Solution

Error :

@galencolin @cubefreak777 @ssjgz

Anyone ?

Didn’t you try dry running the code ? I think they’ve given the input for which it fails.

Just Leetcode Stuff ( Correct Answer on Running , Runtime Error on Submission :sweat_smile: )
I was trying to resolve but looks like I will have to do some hardship ( not sure that after even that I would be able to get it )

1 Like

yes, half of my submissions on leetcode are runtime errors on the first attempt because they have some stupid cases where the string is empty, root is null blah, blah…

1 Like

This one is giving Runtime error for the same Test case for which it is running correctly on leetcode , There is a big issue of Global arrays on Leetcode , I think
P.S. : It is the only site I think which suggests to use Python to Beginner for DSA based Problems

I’d rather choose to quit CP instead of doing it in python lol


Be Happy . ACfied Code
The array you were using in Struct Hash were probably causing MLE , So I changed it to vector , Changes are made in just Struct Hash , Have a look on it

1 Like

It’s not failing at that TC , it just give me this error , also thanks @dhruv788 , ae tam to heavy coder ho bhai , I think same type of error i got in some other contest too , will remember that thing .

1 Like

are bhai bhai bhai :rofl: :rofl: :rofl:

1 Like