I was solving a question which uses a trie and I've taken care of the number of nodes and I repeatedly got MLE upon implementing it using 2D arrays and pointers as well.
I've looked at submissions that used a similar logic and they are getting AC.
Any help as to why this is happening is highly appreciated.
Question : 514C
Submission with Pointers : Pointers
Similar submission : Also Pointers
Submission with 2D array : Array
Similar submission : Also Array
Sorry if I missed something obvious. I am legit stuck here and I can't figure out why this is happening. Can anyone please tell why?
[UPD]
The MLE was occurring because string str was being stored in the function stack multiple times and when the level of recursion becomes huge, it resulted in an MLE. Declaring the variable global solved it.
Accepted submissions :