Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
closing, as it seems the issue comes from your code
to me it looks like you are not properly resetting the
FLAG
variable in your procedure. As a result, it carries its value between calls. At the end of the 3rd test, it is set to1
, so in the 4th test, this branch is not entered like it should:You are also leaving
result
undefined at that point ifFLAG
is not0
, which is not robust. You are being "lucky" that the test case do not reset it to some arbitrary value in-between calls toStringEndsWith
please edit your message to include your entire code, not just the algorithm. And add the
cobol
language ID after the```
backticksThis comment is hidden because it contains spoiler information about the solution