in Java I got with DFS — Memory Limit Exceeded, with BFS — Accepted

Revision en1, by snorkel, 2021-03-08 14:37:10

Recently I was solving the problem from kattis and typed DFS solution and got Memory Limit Exceeded, then I typed exactly the same thing in C++ and got AC. After not figuring out the fix, I went with BFS and it passed (in Java).

This is my DFS:

DFS Code

This is my BFS code:

BFS code

Full Codes:

Full code - with DFS (MLE)
Full code - with BFS (AC)

What can cause this kind of thing?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English snorkel 2021-03-08 14:37:10 6983 Initial revision (published)