Hello everyone, I was giving contest today and I was solving a question, I almost got the logic(atleast I thought that), but I got wrong answer on testcase 2. After contest I went to see what is wrong but I got to know that I can't know the edge case, because it's 120th token and I can't know the 120th input. This has happened to me a lot of time that, my logic is slightly wrong or I made a small mistake in Implementing the code but I can not know what is wrong. Can anyone give me solution for this?
You can see the test case if it's small. Just output the input of that testcase.
Thanks
Here's how you can normally resolve situations like this during the contest.
By the way, I would be careful about calling counterexamples to your solution "edge cases". I mean, sometimes it's true and your solution is just wrong on some very specific cases like $$$n = 1$$$ or whatever. But it might be that your solution is just wrong.
For example in this problem, all your program does is finds the pair of adjacent elements with the largest difference and applies the operation to that. But for example, this means you do
while it would be better to do
I don't think it's fair to call this an edge case. Rather, it's an example demonstrating something that your program doesn't take into account: it might sometimes be better to make a not-so-good operation because it opens up very good operations for later.
Your code might be failing on this test case.
3 2
3 2 1
your code will output 4(I wrote a similar solution and got the same verdict) correct output is 3