MO.AT

What I've been up to

Ramblings and teachings on topics of interest to me.

Leetcode - 42. Trapping Rain Water

Algorithms, Array, Recursion, Two Pointers, Leetcode

There’s one thing common between this problem and the Container With Most Water problem and that is the height of the shorter tower dictates the result. In this problem, the amount of water that can accumulate between two towers is limited by the height of the shorter tower. Consider an array [4, 5, 9, 7 ,1, 0 ,4, 0 ,8 ,6 ,5 ,2 ,3] which is represented as:

Read More

Generate Parantheses

Algorithms, Backtracking, Recursion, String, Leetcode

Before we start solving this problem, let’s do some math first. The problem statement clearly states that we have N pairs of parentheses to work with. That means for a string to be considered as part of the solution, it must be of size 2N.

Read More