Leetcode – 11. Container With Most Water

From the description of the problem, we are told that each number in the array represents the height of the vertical line at that index. So given an array [4, 3, 7, 8, 2, 6, 9, 5], a visual representation of this array would look something like: | | | | | | | | | | | | | …

Mohit AthwaniLeetcode – 11. Container With Most Water

Leetcode – 10. Regular Expression Matching (Dynamic Programming)

This article is in continuation to my previous article solving the same problem with recursion. The fact that this problem could be solved with recursion made me think about the optimal substructure of this problem. As it turns out, this problem has one and can be solved using dynamic programming. To solve using dynamic programming, we will construct a table …

Mohit AthwaniLeetcode – 10. Regular Expression Matching (Dynamic Programming)

Leetcode – 10. Regular Expression Matching

My initial thought after reading the description of this problem is that let’s just consider, for the moment, that this problem needs to be implemented for • only. For e.g given the text abc does it match a•b? You can come up with examples and you will realize that to implement just the •, the lengths of the two strings …

Mohit AthwaniLeetcode – 10. Regular Expression Matching