### shyam81295's blog

By shyam81295, history, 6 years ago,

I have implemented sliding window method in this problem, but there's TLE for testcase 9 . This is the link. I know the solution is wrong, but I want to know where I am going wrong, so that I shouldn't repeat same mistake again. It would be nice if someone of you will guide me to resolve this issue. Thanking in advance.

• 0

 » 6 years ago, # |   +2 It's clear that, your solution has a complexity of O(n^2). Which is not enough to pass the test cases. This problem is very easy to solve using two pointer algorithm. I'm not sure if you are familiar with this algorithm or not. May be you have implemented this algorithm in a wrong way. Try 16375131.
•  » » 6 years ago, # ^ |   0 Thanks froghramar
 » 6 years ago, # |   0 Hello Shyam, I think you re facing pretty problems in basics.When you have any doubt on any problem just post a blog on it and ping me though codeforces talks.I will help you with that.Thanks.Happy coding.
•  » » 6 years ago, # ^ |   0 Thanks mate, I would surely get help from you. I hope it will improve my programming skills faster than practicing alone.