❔ Error for no reason?
I'm trying a leetcode question and I think I've solved it but whenever I run it, I get an error:
Yet I can see with my logs that the whole code runs through and works perfectly, nowhere for this error to occur other than when returning the value. But this error wasn't happening earlier in testing with the same return value
3 Replies
My Code:
Log:
But the important part is just this:
The code works perfectly in VS but not in leetcode, any ideas why?
Ah ok I figured it out, silly mistake
Turns out the error was in fact at the top of the code but it still continued running onto the second testcase and then had an error, I assumed the error would mention what testcase it was on for some reason
you should learn to use the debugger in lieu of logs
much more efficient and powerful for debugging
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.