python-tips

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 …