Java Problem with NZEC

Does codechef judge has some problem with recursive solutions in java ? I have faced this second time that iterative dfs gets AC whereas recursive same recursive version gets NZEC .
Proof : (Both the submissions have just one line different where main calls “dfs()” / “dfsIterative()” .
Recursive dfs getting NZEC and Iterative dfs getting AC . Should i always use iterative version ? But it is more error prone and non-intuitive :frowning:

1 Like

The problem with recursive dfs is stack space to hold recursive data once it exceeds the stack size we get NZEC. So go for recursive dfs first if it works fine then you are done else go for iterative dfs.

1 Like