Can u correct or give some alternate solution its giving TLE for two test cases?

@supratik260699
there are few mistake in your code

  1. check line 17 what if k become n, s[k] doesn’t exist in that case. Thus, your code wiil give segmentation fault. Chnage it to while(k<n && i==s[k])

  2. Add a base case just after line 5 if(start==n){ return; }. This will solve TLE problem.