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

shouldDeleteCurrentNode should also check if the current node is not having other word isEndOfWord as true. #278

Open
AamirB opened this issue Jul 10, 2020 · 0 comments

Comments

@AamirB
Copy link

AamirB commented Jul 10, 2020

return current.children.size() == 0;

if(shouldDeleteCurrentNode){

        current.children.remove(word.charAt(index));
        //return true if no mappings are left in the map.
        return current.children.size() == 0 && !current.isEndOfWord;

    }

Steps:
Add "Aamir"
Add "Aami"
delete "Aamir"
As per the current code this will also delete "Aami"

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

1 participant