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.
your logic is wrong, comparing the sums of ascii codes will lead to false positives, e.g. your code returns
true
for"ac", "bb"
.Other issues:
const
away in your loop to convert the strings to uppercase --> don't do that; not only is it bad practice but it will crash when the strings are immutablenot sure for C but the logic is: check if your summ divides with no remainder first, if yes then just return summ/n C:
No worries :) be aware of the difference between a null string and and an empty one.
What happens in your solution if the string is empty?
op solved the kata
OP solved it, closing
me to
For the 1st sample test, your code returns
true
. However, the inputincludes an underscore, so your code should have returned
false
.Oy. nevermind, I was looking at your solution thinking it was your working draft but it apparently works and I'm obviously wrong about things. My apologies
You're only changing
even
in the event that the first two array elements are the same. I'm betting those will be the tests that do pass. Otherwiseeven == 0
so when you checkarr[i]
against it inside the loop, it does nothing good for you.have you figure it out? It was quite challenging and satisfying to complete this task.
added better messages
It always helps to mention your language. And yes, users who completed the kata in the same langiage can see your most recently attempted code.
Again, you sohuld try and run your solution locally, in your IDE, and call it twice in one test run. There's more than one problem with it currently, but the main issue is the
while
loop which is not really necessary, and causes the problem you see.Another issue is returning a statically allocated buffer, what is almost always wrong. This kata wants you to return a malloced, freeable buffer.
Loading more items...