Search⌘ K
AI Features

DIY: Design Add and Search Words Data Structure

Explore how to design a WordDictionary class in C# that allows adding unique words, searching for exact or wildcard-matched strings, and retrieving all stored words. This lesson helps build skills in data structure implementation and string search algorithms applicable for interviews.

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 ...