Clarification on question

Sir

  1. How to distinguish b/w str and pattern in this case as both are in the same line i.e “aa a*a”
  2. if we get one ‘*’ in pattern, then will it match with every character in str ?

The first string in the input is the text and the second string is going to be the pattern that you are going to match it against. For the second query, yes, the * matches with any number of occurrences of characters.

Getting 3 test-cases correct and 6 wrong in this code:

You are missing one case of recursion. Think of what happens when we try to match * with just a single char

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.