Refer my solution : https://www.codechef.com/viewsolution/26888665.
You can understand the solution by looking at the code, if you don’t understand, let me know.
Thanks for reading.
I have gone through your code it has also used the same logic of finding max and second max of any array , but I used the same logic and did not get AC , have I done something wrong ,please point out because I can’t figure out
Consider the testcase:
1 4 4 1 10 2 10 3 20 4 20
He solved it.
Thanks for helping i thought just by finding the max and min in the array would do the job but apparently it did not.