Sub-Sequence Count

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

1 Like

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.

1 Like

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.

1 Like

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.

1 Like

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.

1 Like

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.

1 Like

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

2 Likes

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

1 Like

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