Introduction

This post covers the Largest Rectangle in Histogram problem on Leetcode.
The challenge is not in figuring out how to solve the problem but rather to figure out how to optimize the runtime. …

Introduction

This blog post covers a variation of the Next Greater Element II problem on Leetcode. It is one of the problems which requires very clever use of a simple data structure. …

Introduction

This blog post covers the Shortest Path In A Grid With Obstacles Elimination problem on Leetcode.
This problem illustrates how a standard graph traversal algorithm can solve a tricky problem if we smartly encode multiple parameters into the graph state.

Problem Statement

You are given an m x n grid, where each…

Introduction

This blog post covers the Predict The Winner problem on Leetcode. It is a dynamic programming problem. The solution is not too hard once we know exactly what to compute.
This post digs deeper into the problem statement to break it down and see how it leads to a DP solution…

Introduction

This blog post covers the Bursting Balloons problem on Leetcode. It is a dynamic programming problem in which coming up with the sub-problem definition is hard.
Instead of directly explaining the solution, this post goes through the thought process of formulating the DP solution in a step-by-step manner.

You are…

Introduction

Coordinate compression is a technique to map a large set of points to a smaller range by removing gaps and/or redundant information. By compressing the points to a smaller range, we can save considerable time and memory.

Most of you would have unknowingly applied 1D coordinate compression but it’s 2D… 