Leetcode Problem #84 (Hard)

Introduction

Problem Statement

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.

Imagine having rectangular blocks arranged in a straight line. Each block has a width of 1 unit and the i-th


Similar To Leetcode #503 (Medium)

Introduction

Problem Statement

Given an array nums, return the previous smaller number (PSE) for every element in nums.

The previous smaller number of an element x is the first number (highest index) to the left of x that is smaller than x. …


Leetcode Problem #1293 (Hard)

Introduction

Problem Statement

You are given an m x n grid, where each cell is either 0 (empty) or 1 (obstacle). In one step, you can move up, down, left or right from and to an empty cell.

Return the minimum number of steps to walk from the upper left corner (0, 0) to the lower right corner (m-1, n-1) given that you…


Leetcode Problem #486 (Medium)

Introduction

Problem Statement

You are given an integer array nums of size n. Two players are playing a game with this array: player 1 and player 2.

Player…


Leetcode Problem #312 (Hard)

Introduction

Problem Statement

You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the balloons.

If you burst the ith balloon, you will get nums[i - 1] * nums[i] * nums[i + 1]


Dealing with huge arrays and large numbers

Introduction

Most of you would have unknowingly applied 1D coordinate compression but it’s 2D coordinate compression that is extremely powerful. This blog post explains both cases.

Coordinate Compression In 1D

Algorithms Digest

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store