I got WA for Increasing , decreasing problem from June Lunchtime

Please check my solution and spot what i did wrong.
https://www.codechef.com/viewsolution/34825450
Any help would be highly appreciated :slight_smile:

1 Like

You were not doing frequency part properly(i would say a bit complex)
I edited your code(Just edited your countFreq Function)
Your AC code-Click Here

There were two conditions to check
1)If frequency of max element >1 then Answer is NO
2)If frequency of element other than max element >2 then Answer is NO

And Friend one piece of advice i wanna share with you that try to avoid making functions and write it in main() function if its possible. :grin:

2 Likes

Here’s video solution of this great problem, the same way explained above : June Lunchtime 2020 Division 2 Problem-B codechef. - YouTube

2 Likes

Hi, thank you so much for clearing the issue. I can now understand why test cases would fail! Thanks for the advice too. I’m starting with CP, and it would definitely help me to solve further contests/problems.

1 Like

Great explaination :slight_smile:

1 Like

Yeah Friend,
All the best for ahead :slightly_smiling_face:

1 Like