An AI generated image of asteroids

Asteroids Collision

Today we’re solving https://leetcode.com/problems/asteroid-collision/ Imagine if we had the following: 1 5 3 8 6 -> -> <- <- -> Each number represents the size of an asteroid. Each asteroid is either going left or right. Bigger asteroids destroy smaller asteroids. Asteroids with same size both get destroyed. If two asteroids are going in the same direction, they don’t hit each other, because all are going in the same speed....

November 20, 2023 Β· 5 min
Multiple envlopes along with their width and height

How Many Envelopes Can You Fit Into Another?

Question: How many envelops can you fit into another? Each envelope has a 2D representation. [4,5] -> width = 4, length = 5 How many envelops can you fit into one another without rotating any envelopes. Bare in mind you can’t fit in two evelopes with same width or height. This is question is very much like a Russian Doll question. Which that question itself uses an Longest increasing subsequence algorithm to solve....

November 12, 2023 Β· 4 min