Posts

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:

  1. Sequence Repetition
  2. List …

Word Break = Choosing …

Intro

In this post we’ll go over the popular leetcode problem Word Break. This posts focuses more on how this problem can be viewed as choosing partitions. I belive that at a first glance it seems like there is no connection between the two so it is a neat discovery to make. In the editorial …

Monotonic Stack/Queue …

Goal

Introduces you mainly to the Monotonic Stack in an intuitive way with code snippets included. This post should help you understand when to start thinking of using a monotonic stack.

Introduction

In some problems like next greater element you see this pattern where one value can trump many …

Processing Tax (Graph …

Goal

The goal of this blog is to discuss graph traversal algorithms and give a little more intuition between the flow of the actual code. The blog assumes you are already familiar with Breadth First Search (BFS) and Depth First Search (DFS) algorithms. I would always forget when do you add a node to …

Countdown Pattern

Introduction

This pattern is pretty rare but it’s easy to spot once you recognize it. Let’s take a look at two problems that have this pattern. It does not improve your time or space complexity but it makes the overall approach to the code a litte simpler.

Koko Eating Bananas …