Problem link I have applied the same approach as mentioned in the editorial , but I am still getting TLE.I need some hints about where I am doing wrong. Mycodelink Thanks for the help in advance.
Problem link I have applied the same approach as mentioned in the editorial , but I am still getting TLE.I need some hints about where I am doing wrong. Mycodelink Thanks for the help in advance.
Constant factors matter. While your solution technically has the correct time complexity, there's no need to use maps in your
data
struct, you could use arrays of size 3 instead, which speeds up your solution considerably.