Can anybody please tell at which test case this code is giving WA: CodeChef: Practical coding for everyone
It fails on the testcase:
1
2 2
50 16
Thanks for the test case.
Hi coders,
Please help me out with the test case for which my code fails as I am getting WA on submissions. I have tried to cover all boundary cases however I feel I am not able to cover all. Link to my code is:
https://www.codechef.com/viewsolution/27940370
Thanks,
Learner
Your solution fails for the testcase:
1
6 2
95 38 9 41 57 5
(the answer should be 4
:
Best choice:
95 38 [ 9] 41 57 [ 5]
R G R G R G
max - min = 4
)
@ssjgz I really appreciate your quick response. I found my mistake and code has been accepted successfully now. Link:
https://www.codechef.com/viewsolution/27942809
I have used the same appraoch but only getting partially AC. @yash_chandnani
Any help would be really Appreciable !!
https://www.codechef.com/viewsolution/30687657
This is my solution
Your solution is O(N^2) (or O(N \times M), or something equally suboptimal ) and times out on the testcase in this post.