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:
you cast 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 immutable
this same loop also assumes that the strings are the same length and that they have lowercase letters at the same indices... you should iterate on them separately, after making a copy first
hi Riley, you're right. I don't comtemplate the case when the string is NULL.
In the instructions, it said the following :
"The given string is not nil/null/NULL/None, so you don't have to check that."
that's why I skipped over.. did I misunderstand this?
hi I am doing this exercise in C and am confused as to what my error is.
Could someone have a look? I am passing all mandatory tests but can't see the ones I am failing in random tests.
Thank you!
Hi I'm doing this project in C, locally I get all the cases and the answers correct, yet I get a time out. I assume it's because of my last loop where I try to find k. I haven't figured out how to make it more efficient. If anyone has a hint, I would appreciate it :)
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
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.
Thank you for your help! i saw my mistake :)
hi Riley, you're right. I don't comtemplate the case when the string is NULL.
In the instructions, it said the following :
"The given string is not nil/null/NULL/None, so you don't have to check that."
that's why I skipped over.. did I misunderstand this?
What happens in your solution if the string is empty?
hi I am doing this exercise in C and am confused as to what my error is.
Could someone have a look? I am passing all mandatory tests but can't see the ones I am failing in random tests.
Thank you!
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
.I don't see where I failed a test for the C kata
Hi I'm doing this project in C, locally I get all the cases and the answers correct, yet I get a time out. I assume it's because of my last loop where I try to find k. I haven't figured out how to make it more efficient. If anyone has a hint, I would appreciate it :)
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
Hi I am writing my code in C and its seems I have a memory problem with my pointer but I don't really understand why? edit i found it
Loading more items...