WA in CHEFBM always

first I was getting the segmentation error …
now when I solved it
I always get a wrong answer
what to do in the case of n=1,m=1

1 Like

That’s very clear in the problem statement. If you can think about the other cases and how to solve them you can solve this one.

i mean last element and first element are same, so cost=0 or -1???

My guess is 0 (haven’t solved this one yet…am in WA)