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

Trie problems #117

Merged
merged 10 commits into from
Oct 22, 2019
Merged

Trie problems #117

merged 10 commits into from
Oct 22, 2019

Conversation

ashokdey
Copy link
Member

@ashokdey ashokdey commented Oct 20, 2019

🔍 What's inside?

This PR contains a few problems involving Trie DataStructure.

  • Total count of words in a Trie
  • All the words in a Trie

@ashokdey ashokdey marked this pull request as ready for review October 21, 2019 05:22
Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashokdey Test cases where all-words-in-trie and total-words-in-trie failed:

  • In all-words-in-trie`
    • words = ['bed', 'ball', 'ball'];
    • output: 2
    • expected output: 3
  • total-words-in-trie
    • words = ['bed', 'ball', 'ball']
    • output : ['bed', 'ball']
    • expected output : ['bed', 'ball', 'ball']

@ashokdey
Copy link
Member Author

@ashokdey Test cases where all-words-in-trie and total-words-in-trie failed:

  • In all-words-in-trie`

    • words = ['bed', 'ball', 'ball'];
    • output: 2
    • expected output: 3
  • total-words-in-trie

    • words = ['bed', 'ball', 'ball']
    • output : ['bed', 'ball']
    • expected output : ['bed', 'ball', 'ball']

Do Tries store the same word twice? The path is same hence I don't see a chance it will store the same word more than once.

@TheSTL
Copy link
Member

TheSTL commented Oct 22, 2019

@ashokdey Suppose I inserted 'ball' 2 times in trie. Path will be same .
Now I asked you tell me the count of unique string then answer should be 1 and tell me count of total string , it should be 2.
Problem is count total words therefore word repetition can be found in input.

@ashokdey
Copy link
Member Author

Thanks, done! 💯

Copy link
Member

@TheSTL TheSTL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashokdey 💯

@TheSTL TheSTL merged commit 00fba31 into master Oct 22, 2019
@ashokdey ashokdey deleted the trie branch October 24, 2019 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants