Work ok in local machine, but Runtime Error in OJ

  • 0

    I'm a beginner in LeetCode, I always find my C++/C solution go to Runtime Error, but it works in my computer. I want to share my debug experience with Runtime Error. I use printf to output debug information. For example, if the input contains many queries, I will output strings to see the progress my program proceed. Then you will finally find out the bugs.
    Mistakes I made:

    1. doesn't initialize pointer to NULL
    2. iteration of array exceed the length of the array

Log in to reply

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