Skip to content

Interesting Dyn. Pgming question #11

Description

@santhoshvai

You have an array of english words {cat, then, hen, end, dog}. Can you make out if the given sentence is a concatenation of only words from the array?

Cathen -> valid
thend -> not valid
cathenend -> valid


I think a trie can be used here. Like a suffix tree. What do you think? (google qn btw)

EDIT: GFG link

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions