Can anyone tell me where my code is wrong? https://www.codechef.com/viewsolution/13202352
You provided the wrong link. Please copy address of link from mysubmissions page.
link is only for you. please provide the public link.
Try tweaking your code such that in case multiple answers are possible, your code prints the one occurring first.
Compilation Successful Input (stdin) 5 1 1 1 5 5 5 1 5 2 Your Output 5
Try that your code prints 1 for this (which is occurring first). If your code works after that, then its an issue with test cases.
The link is updated now.
Check the constraints for K.
I am sorry dear, I am unable to help further. I spent ~ 4 hours on the code, checking test cases and thinking of corner cases. But your code passed all test cases which I had. I don’t think I would be able to assist you further. Hope your doubt gets clarified soon.