so here is the question

and here is my solution

my logic is that if there are 2 or more star in the string then my pointer goes to the first star then skips the max limit allowed ahead and then starts moving back as soon as it finds a star again it resets form that point and starts the whole process again

the time complexity should be O(n) but for some reason it is giving a TLE