Notes

2024-04-03: Basics of Bitmasking - From Backtracking to Dynamic Programming

How to maintain an array in your dynamic programming ‘state’ to go from TLE to performant.


2024-03-25: Chebyshev Distance - How to Transform 2d problems to 1d

Turn your slow 2d geometry problems into 1d O(nlogn) solutions.


2024-03-25: Digit Dynamic Programming

How to solve the “Count the number of positive integers between L and R that satisfy condition” problem.


2024-03-24: Lazy Removal - How to make heap operations (almost) O(1)

You need a heap to get the minimum/maximum, but you also need to update and get values from it constant time. How can you go about doing this.


2024-03-20: Beyond Binary Search - Searching for Ranges

A less common use case for binary search that I recently encountered in an online assessment!


2024-03-18: Sum of distances in an array

A quick solution to a pattern I’ve often encountered in Leetcode contest problems.

How to find the sum of absolute differences between all values in an array and a new item.


2024-03-15: Sliding Window Advanced Technique - At most k, k-1

A niche technique in solving sliding window problems.


2024-03-10: Lessons from Behavioral Interviews

My guide to prepping and acing the Software Engineer Behavioral Interview.


2024-03-09: Leetcode 2915 - Length of the Longest Subsequence That Sums to Target

Return the length of the longest subsequence of nums that sums up to target.

A classic 2D Dynamic Programming problem.


2024-03-05: Frontend Interview Question - Create a Bubble Sort Visualization

Bubble sort is a simple O(n^2) sorting algorithm. Can you make a visualization of the steps played by the algorithm?