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 985: Sum of Even Numbers After Queries

Given an integer array nums and an array of queries, each of which is in the form [value, index], you need to apply each query by adding value to nums[index] and return the sum of even numbers in the updated nums array after each query.

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 991: Broken Calculator

You are given a broken calculator that displays an integer ‘startValue’. In each operation, you can either multiply the number by 2 or subtract 1. Your task is to determine the minimum number of operations needed to transform ‘startValue’ into ’target’.

Leetcode 994: Rotting Oranges

You are given an m x n grid where each cell can be empty, contain a fresh orange, or a rotten orange. Every minute, any fresh orange that is adjacent to a rotten orange becomes rotten. The task is to determine the minimum number of minutes required for all fresh oranges to rot. If this is not possible, return -1.