Help needed ,Doubt in video solution

Does dp[i][j-2] here j starts from 1 ,so 1-2==-1?? index j becomes negative at some point of time

This can occur only when the pattern begins with a ’ * '. I think the pattern will never start with a ’ * ’
Or you can handle this case seperately.

@pratyush63 Sir Can U please provide with additional changes for “you can handle this case seperately?”

No…the code is correct.
It is guaranteed that pattern will not begin with a “*”
You can submit your code here and check https://leetcode.com/problems/regular-expression-matching/

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.