Search⌘ K
AI Features

DIY: Design Add and Search Words Data Structure

Explore how to design and implement a WordDictionary data structure in Java that supports adding new words, searching with wildcard characters, and listing all stored words. This lesson helps you develop problem-solving skills for coding interviews focusing on data structures and string matching functionalities.

Problem statement

Design a data structure that supports the following functions:

  • Adding new words.
  • Finding if a string matches any previously added string.
  • Returning all the words that are present in the data structure.

Let’s call this data structure the ...