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.
Given that a big amount of computational problems do involve quite some math and algos, not just pure knowledge of the language itself, it seems rather fitting at this kyu level.
Even more so, the problem is tagged "number theory" and "algorithms", so yeah, probably you researching the related math is indeed what the author had in mind.
I think the goal is to test your C and algorithm skills. A lot of the hardest computer science problems have solutions that involves maths. I guess that's just the way it goes!
true
true
No, string literals are not allocated on the stack.
How is this respecting the "The returned string should be statically allocated and it won't be freed" requirement? The "true" and "false" here are declared on the stack on the function call, not on the heap and it will BE considered freed and eventually overwritten by some other process using the heap later down the road.
Although it "works" on the surface, returning strings like that will evenatually crash your programs.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Well, that was a 'clear problem' with he kata as when no instruction are executed, there should not be any SEGDEV error. Now if your assertion/testing code is doing a free operation without validation, I can't do nothing on that part as I didn't code it.
An
issue
is reserved for when there is a clear problem with the kata. The C kata is working fine. If you're not sure what's going on, post as aquestion
instead. You're getting aSEGDEV
probably from memory mis-management. You need to return a dynamically allocated, null-terminated C-string as a result, which will be freed by the testing suite.I started to get SEGDEV from testing.
So I commented everything in the function (because my code works under a real compiler) and I still get SEGDEV ??
I am starting to doubt the assertion code being used to valide our code.