There are many problems requiring deep recursion. Usually it’s graph problems with big limitations which are solved by DFS (or solving recurrence of Dynamic Programming recursively). But deep recursion requires large stack size, often several megabytes.
The default Java stack size is quite small. Most of the times it would give Runtime error on Codechef, SPOJ. But when I see the solutions of other user in C++ they don’t have such issue.
It results in writing non-recursive DFS which is sad itself.
Is there any way to run these recursive codes in Java without NZEC errors?