How do I optimise this? I'm getting TLE

I’m getting TLEs on this sol ( of problem( please help me out.
Edit: I couldn’t see other solutions as the ques is from ccdsap past year test. sols arn’t visible.
Edit: sol wasn’t visible so I’ve provided a new link

You code not visible.
Upload it somewhere else and provide link. :slight_smile:


100 pts simple code : here using a set

1 Like

Simple Easy and Understandable Complexity O(n)

thanks alot

your code isn’t visible, can you paste it here?

well a small observation would help u here, the thing is after score i is known the maximum is either the present number or the maximum till the last number.
probably using a map in c++ would do just fine

I am sorry

1 Like