Problem Link : CodeChef: Practical coding for everyone
My Solution : CodeChef: Practical coding for everyone
Any help will be appreciated.
Problem Link : CodeChef: Practical coding for everyone
My Solution : CodeChef: Practical coding for everyone
Any help will be appreciated.
You don’t need the first loop and condition, there will be nothing but a,b,c,d,n! Moreover you are thinking hard. You can just compare the right answer and chef’s answer by using a loop. If it is n just continue and otherwise just skip the index for once. Have a look at this code: CodeChef: Practical coding for everyone
your code is giving wrong answer on this test case
2
AB
CB
ANSWER SHOULD BE 0
YOUR ANSWER IS 1
The 56th line of ur code also counts the test case when the wrong answer in u[i] is N. This should be avoided to get the correct answer
I tried with that approach too. I though I had misread the question or maybe overthought.
Another unsuccessful solution which satisfies your testcase : CodeChef: Practical coding for everyone
I already have a condition which will bypass that condition on line 39.
4
ABAB
ACNB
THIS IS YET ANOTHER TEST CASE ON WHICH UR CODE IS NOT WORKING
It will not bypass the condition… Actually it will consider both conditions and that is where u r getting wrong…
You can check my solution for further improvement…
https://www.codechef.com/viewsolution/24912747
You need to put f=0 before continue in line 40
The Very first condition in loop x== n-1 is not right
Got it.
Thanks mate!
Got it! Thanks mate!