Posts

Directional Dependence

Intro While going over the Flatland Space Station problem it made me stumble to a pattern I have noticed before and wanted to talk more about it. In this problem you run into a situation where the decision you want to make is dependent on two choices. Intuitively these decisions are not hard but …

Power Set

Introduction In this case we want to try all possible variations of the given array. To be more specific we want to try all possible combinations of all possible lengths. What we’re describing here is the power set. There’s a great article that elaborates even further on this however I …

Non Divisible Subset I

Introduction Hackkerank medium problems continue to be a challenge for me. In this problem that we’ll take a look at it was challenging due to the fact that the brute force method seemed fairly involved and the inability to make connections to solve this problem in a faster way. In this post …

Flip Matrix Brute Force

Introduction Warning: Code may not be 100% compilable but it should be close. I was making changes along the way so although at one point it passed the test cases it might not now. In our previous posts we learned how to reverse rows and columns which we can use to solve Flip Matrix in a brute force …

Reversing rows and cols …

Introduction I want to cover the Flipping the Matrix problem in a non optimal way in order to practice a few fundamentals that I think are important. In this post we’ll cover nested loops and list comprehensions and in the next post we will cover backtracking and combinations. List …

2D Matrix One Liner

Introduction Python can be a powerful language since it allows you to acheive a lot through a few lines of code. The example we’re taking a look at in this post is how to create an M x N matrix. dp = [[1]*n for i in range(m)] We’ll break this into two parts: Sequence Repetition List …