All Posts

Leetcode 433: Minimum Genetic Mutation

You are given two gene strings, startGene and endGene, both consisting of 8 characters. You also have a gene bank of valid gene strings that can be mutated into one another. A mutation is defined as changing one character at a time, and the mutated gene string must exist in the gene bank. Your task is to determine the minimum number of mutations needed to transform startGene into endGene. If transformation is impossible, return -1.

Leetcode 438: Find All Anagrams in a String

You are given two strings, s and p. Return the list of start indices of all the anagrams of string p in string s. An anagram of p is a rearrangement of the characters of p, and the start indices should be returned in any order.

Leetcode 443: String Compression

Given an array of characters, compress it by replacing consecutive repeating characters with the character followed by the count of repetitions. If the character repeats only once, just include the character. The result should modify the input array and return the new length of the array.

Leetcode 449: Serialize and Deserialize BST

Design an algorithm to serialize and deserialize a binary search tree (BST). Serialization is converting the tree to a string format, while deserialization reconstructs the tree from this string. The goal is to ensure that the BST can be serialized to a compact string and can be accurately deserialized back into the original tree structure.

Leetcode 451: Sort Characters By Frequency

Given a string, sort its characters based on their frequency of occurrence in descending order. If multiple solutions are possible, any valid answer is acceptable. The frequency of each character refers to how many times it appears in the string.

Leetcode 459: Repeated Substring Pattern

Given a string, determine if it can be formed by repeating a substring of itself multiple times.