Why do i get tle?Length of the longest substring without repeating characters

Hello @khushipriya681,

Your program is causing TLE for testcases like:
1
112

where there are same digits at consecutive positions.
It is working perfectly for 123 but not for 112.

I would suggest you to dry run your code on above test cases to understand this better.

Hope, this would help.
If you still face problem, feel free to ask.

Hints:

  1. there is a problem in the way you are changing the value of i after each iteration.
  2. Can you use start for setting value of i after each iteration? Think.

Give a like, if you are satisfied.