Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L4_DistinctSubstrings_Cpp #2

Open
ravisha7feb opened this issue Dec 27, 2021 · 1 comment
Open

L4_DistinctSubstrings_Cpp #2

ravisha7feb opened this issue Dec 27, 2021 · 1 comment

Comments

@ravisha7feb
Copy link

I have a similar solution and tried copy-pasting your solution on the coding ninjas platform. I am getting TLE and my score is 88. How can we optimize this?
My code: https://pastebin.com/XRHhLaw9

@parmaraakash7
Copy link

I have a similar solution and tried copy-pasting your solution on the coding ninjas platform. I am getting TLE and my score is 88. How can we optimize this? My code: https://pastebin.com/XRHhLaw9

Try deleting memory allocated to trie using deconstructor
like this
~Node() { for (int i = 0; i < 26; i++) { if (links[i] != NULL) delete links[i]; } }
and at the end
delete root
This will remove TLE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants