Efficiently Solving Leetcode 240: Search A 2D Matrix II Introduction: In this article, I'll walk you through the thought process and solution for Leetcode problem 240: "Search a 2D Matrix II". This problem tests our ability to search in a 2D matrix w...
Maximum Distance in Arrays(From Intuition to the Optimized Code: Intuition: Intuition behind this problem is to first find all the pairs such that we got maximum absolute difference, But in question it is mentioned that m arrayLists are sorted, So ca...
Hello, world! I’m excited to announce the launch of my new blog series on Hashnode, titled "LeetCode Like a Lady: Cracking Coding Interviews in Heels". I’ll be documenting my journey through Data Structures and Algorithms (DSA). I've completed the ar...
Introduction Solving algorithmic problems is a critical skill for any aspiring software engineer, and LeetCode offers a treasure trove of challenges to hone this skill. One such problem is the "Product of Array Except Self," a classic problem that te...
Introduction The "Coin Change" problem is a classic algorithmic challenge that often appears in coding interviews and competitive programming. Solving this problem efficiently is crucial for aspiring software engineers as it tests one's understanding...
Software engineering interviews can be daunting, especially when they involve algorithmic questions which are a staple at many top tech companies. This blog post will guide you through getting started with your interview preparation using LeetCode, a...
Documenting LeetCode solving. Q126 10. Regular Expression Matching Hard. DP class Solution: def isMatch(self, s: str, p: str) -> bool: dp = {} def dfs(i, j): if (i, j) in dp: return dp[(i, j)] ...
Documenting LeetCode solving. Q125 312. Burst Balloons Hard. DP Reverse thinking. class Solution: def maxCoins(self, nums: List[int]) -> int: nums = [1] + nums + [1] dp = {} def dfs(l, r): if l > r: ...
Documenting LeetCode solving. Q123 115. Distinct Subsequences Hard. DP class Solution: def numDistinct(self, s: str, t: str) -> int: dp = {} def dfs(i, j): if j == len(t): return 1 if i == ...
Documenting LeetCode solving. Q121 97. Interleaving String Medium. 2D DP. class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: if len(s1) + len(s2) != len(s3): return False dp = [[False] * (len(s...