Impossible to debug (and sometimes submit) code with Morris Traversal

Hi @Leetcode,

I'd like to report a bug (or a missing feature): it is not possible to debug code containing Morris tree traversal. The reason, as I understand it, is that the debugger reports a TreeNode value as an entire subtree corresponding to the TreeNode, meaning that it traverses the tree itself and because of the temporary links created during Morris traversal, the debugger goes into an infinite loop.
Moreover, on multiple occasions I was unable to even run the code without the debugger, as an error was reported. The same code worked fine during local testing, both with and without the optimizations.

Language: C++
Example problem: https://leetcode.com/problems/inorder-successor-in-bst/

Best regards

Comments (1)