Solved! Leetcode 1507. Reformat Date

Table of ContentsDescription: Reformat DateExample 1Example 2Example 3ConstraintsSolution Description: Reformat Date Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th", ..., "30th", "31st"}. Month is in the set {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}. Year is in the range [1900, 2100]. Convert the date string to the ...

Solved! Leetcode 623. Add One Row to Tree

Table of ContentsDescription Add One Row to TreeExample 1Example 2ConstraintsSolutionTime ComplexitySpace Complexity Description Add One Row to Tree Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth. Note that the root node is at depth 1. The adding rule is: Given the integer depth, for each not null tree node cur at ...

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 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 ...