debugging c++ in leetcode playground


  • 0
    P
        string line;
        std::cout << "Here starting main" ;
        while (getline(cin, line)) {
            ListNode* l1 = stringToListNode(line);
            getline(cin, line);
            ListNode* l2 = stringToListNode(line);
            
            ListNode* ret = Solution().mergeTwoLists(l1, l2);
    
            string out = listNodeToString(ret);
            cout << out << endl;
        }
        return 0;
    }
    

    Error message when i run the code i playground

    terminate called after throwing an instance of 'std::invalid_argument'
      what():  stoi
    

    So i put a cout statement in the main function to help me see if this even works, why wont it even print that.
    I feel like the skeleton code for debugging has gone bad.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.