I am trying to solve Autocomplete Problem and implementing trie solution for it. I am getting segmentation fault when the length of the input string is 10^6. It seems to be a out of memory issue and I am not able to figure out where I am going wrong. The link to the solution is here . Please help !!
Thanks
Segmentation fault may be due to the recursive solution (Stack Overflow at that 10^6 recursion depth.) I did use an iterative version and got AC.
It's most probably because of the stack size limit, had a very similar code and happened to me too, as suggested by pikaynu, you can implement it iteratively or you can increase the stack size limit and it will work on your PC but may or may not work on the judge's depending on the stack size there.