Leetcode 0211. Design Add and Search Words Data Structure

Posted on Tue 05 November 2024 in Leetcode • Tagged with trie-prefix-tree, dfs, recursion

Question Link : https://leetcode.com/problems/design-add-and-search-words-data-structure/

Difficulty: Medium

Premium: False

Question

Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class:

WordDictionary() Initializes the object. void addWord(word) Adds word to the data structure, it can …


Continue reading

Leetcode 0212. Word Search II

Posted on Sun 26 March 2023 in Leetcode • Tagged with backtracking-with-matrix, trie-prefix-tree

Question Link : https://leetcode.com/problems/word-search-ii/

Difficulty: Hard

Premium: False

Question

Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically …


Continue reading

Leetcode 0208. Implement Trie (Prefix Tree)

Posted on Thu 16 March 2023 in Leetcode • Tagged with trie-prefix-tree

Question Link : https://leetcode.com/problems/implement-trie-prefix-tree/

Difficulty: Medium

Premium: False

Question

A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker …


Continue reading