I submitted following solutions to This problem :
- 207930808 : my submission using dfs gives runtime error on test 17 when ran on pypy — 64.
- 207931701 : same submission using dfs gives runtime error on test 13 when ran on python — 3.
- 207933061 : this submission using queue (without recursion) passes.
- 207933318 : if I set recursion limit then this gives MLE on test 1 when ran on pypy — 64.
- 207933634 : but same code as above gives runtime error on test 16 when ran on python — 3.
Can someone please help why this is happening and how to avoid these runtime errors while writing recursive functions in python ? Or maybe their is something wrong with my logic itself and functions are correct :|