Segment a String into Vocabulary Words

Asked at Compass · Coding Questions · Difficulty: Medium

Given a string and a vocabulary, decide whether the whole string can be cut into pieces so that every piece is a vocabulary word. This is the check a tokenizer or a URL-slug parser runs before it tries to split glued-together words.

Loading the problem…