• Custom User Avatar

    your function listen() clashes with POSIX's listen(). Criterion is probably using listen() somewhere for inter-process communication and calls your function instead, leading to a crash. Rename it, and your code will pass.

  • Custom User Avatar

    I wrote my solution in C, but the test program is crashing, the problem is in the libcriterion.so, there is some way to attach the gdb on it and see what is going on?
    Just in case, i wrote this simple function to verify my code locally and all sample tests are working!

    void fixed_test(size_t n, enum Event events[], enum State waited_result){
    	if(get_TCP_state(n, events) == waited_result){
    		puts("[+] g00d [+]");
    	} else {
    		puts("[-] b4d [-]");
    	}
    }
    

    This is the error, as i can't attach any debbuger i can't see what is in those addresses:

    /usr/lib/libcriterion.so.3(+0x32b87)[0x7f3d3b842b87]
    /usr/lib/libcriterion.so.3(+0x34e0a)[0x7f3d3b844e0a]
    /usr/lib/libcriterion.so.3(+0x1a34b)[0x7f3d3b82a34b]
    /usr/lib/libcriterion.so.3(+0x270fd)[0x7f3d3b8370fd]
    /usr/lib/libcriterion.so.3(+0x21cc4)[0x7f3d3b831cc4]
    /usr/lib/libcriterion.so.3(+0x193f3)[0x7f3d3b8293f3]
    /usr/lib/libcriterion.so.3(+0x176ef)[0x7f3d3b8276ef]
    /usr/lib/libcriterion.so.3(+0x11e96)[0x7f3d3b821e96]
    /usr/lib/libcriterion.so.3(criterion_run_all_tests+0x1d2)[0x7f3d3b8183b2]
    /usr/lib/libcriterion.so.3(main+0x30)[0x7f3d3b8170f0]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f3d3af18c87]
    ./test[0x400b2a]
    Invalid argument [22] (/src/criterion/build/nanomsg-build/src/nanomsg/src/aio/usock_posix.inc:353)
    
  • Custom User Avatar

    I think there're lots of fake users vote for this solution by best practice why ?

  • Custom User Avatar
  • Custom User Avatar

    This kata is overrated - it feels like it belongs to the 6th level (at best)
    =_=

  • Custom User Avatar

    I'll say, but keep in mind that this approach is more concise and efficient than your method, especially for larger numbers.

  • Custom User Avatar

    Wow... that's insane

  • Custom User Avatar

    You are right. I know you are not supposed to 'invent the wheel again' but this exercise is great to learn algorithmic thinking and complex concepts like recursion.

  • Custom User Avatar

    I think it's better to use this space to do what you wanted to do at first. This is a great exercise to understand and practice algorithms and recursion

  • Custom User Avatar

    yeah that's the way she goes sometimes. i do these challenges just to nail into my brain the kinds of built in functions you can use, because I hate doing what you did and realizing I spent so much time for no reason. A good rule of thumb is that for 7/8 kyu problems, you generally don't have to reinvent any wheels.

  • Custom User Avatar

    Wut?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    good though

  • Custom User Avatar

    I think it would have been better if you had tried to get to the algorithm properly. You would have learned more. Using the solution is good when you already know how to get to the solution.

  • Loading more items...