Can any one please help me with this problem, i am not able to get to an optimal solution.

first sort the array and then use sliding window to find the subarrays which satisfy the above condition and in the end add ânâ to the answer because each element individually is also satisfying the condition.

how will the sliding window be useful in this case as we need to check all subsequences with different lengths.

this is a live problem from ODESSA HACKATHON 2020, on hackerearth.

I had given the contest yesterday and i thought its over now and there will be no editorial so thatâs why i aksed it here.

There is no point in CHEATING!!! a question of a 3 hr contest on a discussion platform. I was not able to get to optimal solution thatâs why i asked it here Just to learn.

I can Totally understand your situation. (And may be i should say a sorry tooâș)

But, the contest is currently live. If, the solution is discussed, then that is going to help others during live content, which i think, should not be the case.

please, allow the contest to end.

End date : 18th Mayâ19

Yeah you are right if contest is live then we shouldnât discuss it ,we can discuss it after 18 and if you were able to solve the problems then we can discuss it.

This is the wrong solution.

I read the question. Figured out the correct simple approach in under a minute. Will discuss it when contest ends

Well i tried this and luckily it got accepted well would love to see your approach and also please do discuss rest two questions if someone had solved them they two were also really great question.

Ok,ok,sorry,I get it. When you said âsort the arrayâ,I assumed the solution is WAâŠthen realized that its ok to sort as guys are only talking about the first and last element.

Sorry

No issues man can you help me out with this problem like how to approach it that would be great if you do so

and here goes the link to the problem

see if you get this.

Ok,Iâve solved it. Its such a nice problem. Iâll write its editorial on Codechef discuss

3rd question I didnât see. 2nd one is a basic-trie problem

I understood the sorting part, but after that the straightforward thing to do is binary search, may I know how/what did you do with sliding window after the contest? Thanks!

To allâŠ

Please donât discuss before it endsâŠ

Yup,now,as usual, after getting all nice info about the problem, @l_returns will secretly enter that contest with his tools and weapon and destroy the competition. Beware Guyzz!!

share krte hi Kyo ho details

now the competition is over now can some one help us out with the problem sub sequence count