All Posts

Leetcode 139: Word Break

Given a string s and a dictionary of words wordDict, return true if s can be segmented into a space-separated sequence of one or more words from the dictionary. The same word in the dictionary can be reused multiple times.

Leetcode 208: Implement Trie (Prefix Tree)

Implement a Trie data structure that supports inserting words, searching for exact matches, and checking if any word starts with a given prefix.

Leetcode 211: Design Add and Search Words Data Structure

You are tasked with creating a data structure that allows adding words and checking if a word matches any previously added word, with support for the wildcard ‘.’ character.

Leetcode 386: Lexicographical Numbers

Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. The solution must run in O(n) time and use O(1) extra space.

Leetcode 421: Maximum XOR of Two Numbers in an Array

Given an array of integers, your task is to find the maximum result of the XOR operation between any two elements from the array. The goal is to maximize the XOR value of any pair of numbers in the array, where the XOR of two numbers is computed using the bitwise XOR operation.

Leetcode 648: Replace Words

In English, certain words can be formed by adding a suffix to a root word. Given a list of root words and a sentence, replace every word in the sentence that is a derivative of any root word with the shortest root. If a word can be formed by more than one root, replace it with the shortest root.