All Posts

Leetcode 984: String Without AAA or BBB

Given two integers a and b, generate a string of length a + b such that the string contains exactly a ‘a’ letters and exactly b ‘b’ letters, while ensuring the substring ‘aaa’ and ‘bbb’ do not appear.

Leetcode 988: Smallest String Starting From Leaf

You are given the root of a binary tree, where each node contains a value between 0 and 25, corresponding to letters from ‘a’ to ‘z’. Your task is to find the lexicographically smallest string that can be formed by traversing from a leaf node to the root node, using the values in each node as letters.

Leetcode 990: Satisfiability of Equality Equations

You are given a list of equations where each equation represents a relationship between two variables in the form ‘xi==yi’ or ‘xi!=yi’. Determine if it’s possible to assign integer values to variables such that all equations are satisfied.

Leetcode 1002: Find Common Characters

Given a list of words, return an array of characters that appear in all words. The output should include duplicates of characters as they appear in each word, and the answer can be returned in any order.

Leetcode 1003: Check If Word Is Valid After Substitutions

You are given a string s consisting of only the characters ‘a’, ‘b’, and ‘c’. A string is considered valid if it can be formed by repeatedly inserting the substring ‘abc’ into any position of an empty string. Your task is to determine if s can be a valid string after performing this operation any number of times.

Leetcode 1016: Binary String With Substrings Representing 1 To N

Given a binary string s and a positive integer n, determine if the binary representation of all integers from 1 to n (inclusive) are substrings of s. A substring is defined as a contiguous sequence of characters within a string. Return true if all the binary representations of the integers in the range [1, n] are present as substrings of s, otherwise return false.