islam-al-aarag's blog

By islam-al-aarag, 12 years ago, In English

I've been debugging this for a while and I still can't tell why it exceeds the memory limit.
Can somebody help me?
Submission: 5723491

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
12 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Turns out using ArrayDeque instead of LinkedList makes the problem pass.

»
12 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I have the same problem, what can I do? Submission : 5724820

»
12 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

I have the same problem MLE:

Submissions:

I first started with recursive dfs with excessive usage of new (1st submission), so I kinda removed it, then found the longest path will overflow the stack. So, I went to iterative bfs, while storing the final nodes, and following back their path (2nd submission), it didn't go well. So, I removed all that and calculated the distances as I go through the BFS (3rd submission), and now I have no idea, what might have caused the MLE, given that I seen Java solutions similar to what I do. Any help?