Regex Matching .. One of the test case giving run error


Hey … this is my code for the ques solution and it passes on leetcode but it is giving me a run error on the test case no 6 … while all other test cases are correct ans … If it is passing on leetcode I guess there are very bleak chances of being fool proof so I guess there may be a problem with the test case itself … Pls look into it once

Hey @prabh1601
Issue is not with the test cases
Your code failed an edge case
The reason is that you’re using O(S*T) memory
Which overflowed memory of function
You can actually solve this question with O(T) memory


You can see the solution here

If your doubt is resolved please close it.

constraints mention 1e8 … how can it overflow the memory… i mn a vector of total size of 1e8 is viable

I tried the O(t) space code also and that too gives run error on the same test case 6 as previous … I genuinly think that something is wrong with the test case … also 2d space solution should pass … test setter did definately some mistake

@prabh1601
Try to submit the approach 2 code
The testcase is fine

The above code contains both codes of editorial … u urself try submitting it … M done submitting

@prabh1601
I submitted the second one and got AC
Since you’ve already opened the editorial please refer to it