WA in MINOPS

https://www.codechef.com/viewsolution/32161754
Can Someone tell me the mistake in this code of mine. I am not getting where am i going wrong. Maybe i am missing some of the edge cases.

Try this testcase:
bbabbccaabcccacabcbc
ccbbbcbabcaccabbaccc

O/P should be 19.
PS: this test case was mentioned on other articles. Its not mine.

also try for test cases having either identical strings, completely different or having N = 1 ( i.e, a a OR a b ).

thanks for your reply @rawnit_kohli. I got the problem with my approach. Now it’s giving AC verdict :grinning: :grinning:

For which testcase was your code misbehaving?
I’m still stuck with WA. Help Please.

aaabcddd
aaaefddd

mine is working fine on this one.
O/P is 2 right?

yes output will be 2.
Just Try For This One Too.

aaabbbbaaa
ababcbdaaa

Not my own testcase but i found that my previous solution was giving wrong answer for this.

1 Like

I’m getting 6 for this one. And i think it is correct. isn’t it?

btw, thanks.

Yes, it’s 6.
Can you share the link of your code, maybe I could find out the problem or a missing edge case.

https://www.codechef.com/viewsolution/32231315

I added comments for ease of understanding the code.
https://www.codechef.com/viewsolution/32337150