Please I desperately need help! JUNE LUNCHTIME

This post was flagged by the community and is temporarily hidden.

Why are you posting twice?

because he’s really desperate :grin:


i didn’t get any reply earlier

Yes sir;)

Honestly i don’t know java, but i had some basics studies in my college last year.

bit i figured out 2 mistakes…

			} else if (count==0&&m.get(a[n-1])==1) {
				ArrayList<Integer> al=new ArrayList<>(s);
				for(int i=a.length-1;i>=0;i--) {
					if(m.get(a[i])==2&&a[i]<a[n-1]) {     <-- 2 errors here

1 ) count of dublicate values can be greater than 2.
2 ) to check strictly decreasing values, you would have to check for every consecutive two values. and you only comparing with value at n - 1 index.

Extra Tip : keep you code properly indented, that would make it too easy to understand.

I think now you’ve got the partial points. And its TLE that is troubling you now. So just use Fast Output i.e., PrintWriter and you will get an AC.


Friend i was checking your code.As i am not familiar with java it took some time and you posted it again lol.

Although i replied on the previous post.

:sweat_smile: sorry sir
Yes sir I got ,I was using hashset earlier I should have used treeset .

And sir I think I have to use more fast output method in java .
Thank you sir for help…