Ad
  • Default User Avatar

    Either I'm experiencing an incredible brain failure or merely trying to access a member of the input array causes a SIGSEGV signal.
    I'm guessing that's what RafaARV means.

    static TreeNode* arrayToTree(std::vector<int> arr) 
    {
        int value = arr[0];
        
        return NULL;
    }
    
    Process exited prematurely with a SIGSEGV signal.
    

    EDIT: Even stranger, at() seems to work just fine, i.e.:

    int value = arr.at(0);
    

    EDIT 2: Just realised the first test is an empty vector, hence arr[0] freaking out. doh.

  • Default User Avatar

    To be completely honest I stole it from Codility. I just find CodeWars a much nicer environment and thought I'd give others the benefit of doing it here :)

    I'm still figuring out the interface so I'll see how I can add random tests at some point.

  • Default User Avatar

    Debugging seems to be an absolute bitch. Am I missing something or is the only output I'm allowed to see that of the tests? =/