String window Problem

Why I am getting TLE ?

@vaishnavtannu
There are few mistakes in your code

  1. when no substring exist, then you have to return “No String” not “-1”. So change line no. 9 and 45 accordingly.
  2. In line 16, your start_idx should be initialise with -1 not with 0.
  3. Your code is showing TLE because see condition in line 27. It always remains true for particular value of i, since i is not increment inside that while loop. Change i to start in line 27 to 33.

@vaishnavtannu
Here is your updated code. It is working fine for all testcases