ADAjay Dandgeinnobleknight.hashnode.dev·Jul 22, 2024 · 3 min readLeetCode #2392 Build a Matrix With Conditions, Topological Sort and Kahn's AlgorithmYou are given a positive integer k. You are also given: a 2D integer array rowConditions of size n where rowConditions[i] = [above<sub>i</sub>, below<sub>i</sub>], and a 2D integer array colConditions of size m where colConditions[i] = [left<sub>i<...00
ADAjay Dandgeinnobleknight.hashnode.dev·Jul 17, 2024 · 1 min readLeetCode #236 Lowest Common Ancestor of a Binary TreeGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: "The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q ...00
ADAjay Dandgeinnobleknight.hashnode.dev·Jul 12, 2024 · 3 min readLeetCode #1717 Maximum Score From Removing SubstringsYou are given a string s and two integers x and y. You can perform two types of operations any number of times. Remove substring "ab" and gain x points. For example, when removing "ab" from "cabxbae" it becomes "cxbae". Remove substring "ba" and ...00
ADAjay Dandgeinnobleknight.hashnode.dev·Jul 11, 2024 · 2 min readLeetCode #1190 Reverse Substrings Between Each Pair of Parentheses and Wormhole Teleportation TechniqueYou are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should not contain any brackets. Let's traverse string s charac...00
ADAjay Dandgeinnobleknight.hashnode.dev·Jul 10, 2024 · 1 min readLeetCode #1598 Crawler Log FolderThe Leetcode file system keeps a log each time some user performs a change folder operation. The operations are described below: "../" : Move to the parent folder of the current folder. (If you are already in the main folder, remain in the same fold...00