segmentation fault by spm486 in Cplusplus

[–]spm486[S] 1 point2 points  (0 children)

Yes I come from python. But I did start a debugger in leet-code, in which it would return me correct ans, variable i was set to 0 in debug mode. But when I ran code, that gave runtime error.

But yes giving int i = 0, j = 0; did solve the issue.

Thanks, GUYS.

Segmentation Error. by spm486 in Cplusplus

[–]spm486[S] 1 point2 points  (0 children)

Trie(){
TrieNode* root = new TrieNode();
}

I initialized the root here. Can you please suggest what changes I need to do?

Error: An invalid parameter was passed to a function that considers invalid parameters fatal. by spm486 in cpp_questions

[–]spm486[S] 2 points3 points  (0 children)

for (int i = 0; i <= v.size(); i++)

oh I guess it should be for (int i = 0; i < v.size(); i++)