Boundary cases?

Boundary cases for below code where it is going to fail?
Last edited on
for ex:
cabc c total no of substring containing c is=7
Regarding 'c' == 'c' there are only 6: c, ca, cab, cabc, abc, and bc.
@MikeStgt sorry for incomplete information.
I think,now you get a good idea about ques and my approach
I did not (non yet) dig too deep into your code, but at first glance I see in case you get a match you account for all possible substrings (what currently fails). I do not understand what could be the reason of the else branch.
@MikeStgt I am not talking about particular case.
if we see for any general case let's say abaabc c .So for such type of cases else branch is there.
explain your approach, I don't want to guess the meaning of `q' `u' `d'


¿may `s' be empty?
Last edited on
for such type of cases else branch is there.
It steps into the else branch in the second loop repetition for cabc c, for abaabc c already in the first run. At that time your procedure does not "know" if there is any c in string, so there is no reason to already count something (implicit IMO). I double ne555's request.
@ne555 @Mikeget

So here is the approach:

Last edited on
I think this is the best i can explain to you.Feel free to ask any other query.
Tested your examples, tested three more, using your program shown (now) in OP. All restults are as expected. I would say: WAD (works as designed ... ah, no -- as desired).
Topic archived. No new replies allowed.