All Posts

Leetcode 645: Set Mismatch

You are given a list of integers that should originally represent all numbers from 1 to n. However, one number appears twice and another number is missing. Your task is to find the number that is duplicated and the one that is missing.

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.

Leetcode 652: Find Duplicate Subtrees

Given the root of a binary tree, return all duplicate subtrees. For each duplicate subtree, return the root node of any one of them. Two trees are considered duplicates if they have the same structure and node values.

Leetcode 659: Split Array into Consecutive Subsequences

You are given a sorted integer array nums. Determine if it is possible to split nums into one or more subsequences such that each subsequence is a consecutive increasing sequence and each subsequence has a length of 3 or more.

Leetcode 676: Implement Magic Dictionary

Design a data structure that supports searching for words that can be matched by changing exactly one character.

Leetcode 677: Map Sum Pairs

Design a map-like data structure that supports key-value insertion and sum queries for keys starting with a specific prefix.