Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    Yes, that was it - thanks!

  • Custom User Avatar

    That was it! Thank you so much, it was driving me nuts.

  • Custom User Avatar

    (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?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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!

  • Custom User Avatar

    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?

  • Custom User Avatar

    You are right, I found the error in my numbering of array elements. Thanks for comment.

  • Custom User Avatar

    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?

  • Custom User Avatar

    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.

  • Custom User Avatar

    Got it - thanks!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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!

  • Custom User Avatar

    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)".

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...