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.
I appreciate your comments. I should know this. I got confused because I was recently learning linked lists where I am allocating simple flat pointer to the address of the head, then proceeding to allocate memory for the nodes.
Yes, that was it - thanks!
That was it! Thank you so much, it was driving me nuts.
(in C) I get the right answer, store it in string "expected" which is passed from main. All works fine while I'm in the crack function (i.e. I print "expected" to screen and confirm it is correct). In main, the value in "expected" is different. I am starring at my code for an hour now, with no idea what the problem may be. Any suggestions?
This comment is hidden because it contains spoiler information about the solution
Very nice kata, but testing seems to be excessive. After passing 12000 tests, my solution fails due to alleged memory violation, apparently at 1st dual glider test. How can I get a clue what I am doing wrong?
Edit: I understood the testing mechanism (it wasn't excessive). I found the error in my code. Great kata, thank you!
Very nice kata, thank you! I post this as satisfaction rate (currently 88%) appears low - kata made me study how to return pointer to array of structs, and how to control limits of parameters to avoid segmentation errors. I don't think my algorithm was particularly efficient, but no timeout problem; perpahs it is because I used c?
You are right, I found the error in my numbering of array elements. Thanks for comment.
My solution fails Attempt at 4th test, with error "Test Crashed Caught unexpected signal: SIGSEGV (11). Invalid memory access". Is the issue likely to be with my code, or could it be caused by memory leak mentioned in this thread?
I had the same, problem was wrong length of returning array. If you get } as result, it is zero, and in the test you quoted it should be one.
Got it - thanks!
This comment is hidden because it contains spoiler information about the solution
I found the error - it wasn't enough to declare n as long, I had to type cast all equations as well. Appreciate your response!
My solution (in C) fails random test with error message "Caught unexpected signal: SIGFPE (8). Erroneous arithmetic operation.". I could reproduce the error both in Sample Tests and on my local machine by setting the input (n) to 300000000. Is this number special in any sense?
If indeed random tests feed values larger than 300000000, any advice how to work around this? I experimented with changing int to long long with no avail.
Edit: I changed all data types to unsigned long long, and pushed the breaking point to 1000000000. At this number on my machine I get an error "136(Floating point exception)".
This comment is hidden because it contains spoiler information about the solution
Loading more items...