Solved! Leetcode 2696. Minimum String Length After Removing Substrings

Table of ContentsDescription Minimum String Length After Removing SubstringsExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Description Minimum String Length After Removing Substrings You are given a string s consisting only of uppercase English letters. You can apply some operations to this string where, in one operation, you can remove any occurrence of one of the substrings "AB" or "CD" from s. Return the minimum possible length of the resulting string that ...

Solved! Leetcode 2068. Check Whether Two Strings are Almost Equivalent

Table of ContentsDescription Check Whether Two Strings are Almost EquivalentExample 1Example 2Example 3ConstraintsSolutionTime ComplexitySpace Complexity Description Check Whether Two Strings are Almost Equivalent Two strings word1 and word2 are considered almost equivalent if the differences between the frequencies of each letter from 'a' to 'z' between word1 and word2 is at most 3. Given two strings word1 and word2, each of length n, return true if word1 and word2 are almost equivalent, or false otherwise. The frequency of a letter x is the number of times it occurs ...

Solved! Leetcode 129. Sum Root to Leaf Numbers

Table of ContentsDescription Sum Root to Leaf NumbersExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Description Sum Root to Leaf Numbers You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123. Return the total sum of all root-to-leaf numbers. ...

Solved! Leetcode 404. Sum of Left Leaves

Description Sum of Left Leaves Table of ContentsDescription Sum of Left LeavesExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of another node. Example 1 <strong>Input:</strong> root = [3,9,20,null,null,15,7] <strong>Output:</strong> 24 <strong>Explanation:</strong> There ...

Solved! Leetcode 2073. Time Needed to Buy Tickets

Table of ContentsDescription: Time Needed to Buy TicketsExample 1Example 2ConstraintsSolution 1Time Complexity Space ComplexitySolution 2Time ComplexitySpace Complexity Description: Time Needed to Buy Tickets There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line. You are given a 0-indexed integer array tickets of length n where the ...

Solved! Leetcode 1700. Number of Students Unable to Eat Lunch

Table of ContentsDescription Number of Students Unable to Eat LunchExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Description Number of Students Unable to Eat Lunch The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers 0 and 1 respectively. All students stand in a queue. Each student either prefers square or circular sandwiches. The number of sandwiches ...

Solved! Leetcode 950. Reveal Cards In Increasing Order

Table of ContentsDescription Reveal Cards In Increasing OrderExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Description Reveal Cards In Increasing Order You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i]. You can order the deck in any order you want. Initially, all the ...

Solved! Leetcode 1669. Merge In Between Linked Lists

Table of ContentsMerge In Between Linked ListsDescriptionExample 1Example 2ConstraintsApproachSolution Merge In Between Linked Lists Description You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1‘s nodes from the ath node to the bth node, and put list2 in their place. The blue edges and nodes in the following figure indicate the result: Build the result list and return its head. Example 1 <strong>Input:</strong> ...

Solved! Leetcode 935. Knight Dialer

Solved! Leetcode 935. Knight Dialer
source: https://leetcode.com/problems/knight-dialer/ 935. Knight Dialer Table of Contents935. Knight DialerDescriptionExample 1Example 2Example 3ConstraintsSolution Description The chess knight has a unique movement, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an L). The possible movements of chess knight are shown ...

Solved! Leetcode 1980. Find Unique Binary String

Table of ContentsFind Unique Binary StringSourceDescriptionExample 1Example 2Example 3ConstraintsSolution Find Unique Binary String Source https://leetcode.com/problems/find-unique-binary-string/ Description Given an array of strings nums containing n unique binary strings each of length n, return a binary string of length n that does not appear in nums. If there are multiple answers, you may return any of them. ...