I am getting run-time error most of the time in python in problems involving trees. I have increased recursion limit then also I am getting run-time error .And same logic works in C++.
Some of my recent submissions 119637795,119420809 and there are many more .
I want help, Is there any way of doing DFS in python without getting run-time error.
I don't think there is any solution for this "problem". instead one should get comfortable in c++ programming.
The solution is wrapped into a function. This function is run in a new thread. Before that, the stack limit for new threads is updated.
The trick of starting a new thread to control the stack size in the contests is old. I first saw it used for Java some time around 2010. 119420809 Now it is accepted. I got the solution thanks to Gassa