All Posts

Leetcode 300: Longest Increasing Subsequence

Given an integer array ’nums’, find the length of the longest strictly increasing subsequence. A subsequence is a sequence derived by deleting some elements without changing the order of the remaining elements.

Leetcode 309: Best Time to Buy and Sell Stock with Cooldown

You are given an integer array ‘prices’, where ‘prices[i]’ represents the price of a stock on the i-th day. You are allowed to complete as many transactions as you like, with the restriction that after selling a stock, you cannot buy again the next day (cooldown). The goal is to calculate the maximum profit you can achieve by making any number of transactions while respecting the cooldown period.

Leetcode 310: Minimum Height Trees

You are given a tree with ’n’ nodes labeled from 0 to n-1, represented by ’n-1’ edges. Your task is to find all roots that minimize the height of the tree. The height of a tree is defined as the number of edges in the longest downward path from the root to any leaf.

Leetcode 316: Remove Duplicate Letters

Given a string ’s’, remove duplicate letters so that every letter appears once and only once. The result should be the smallest lexicographical order among all possible results.

Leetcode 318: Maximum Product of Word Lengths

Given a list of words, return the maximum product of lengths of two words such that the two words do not share common letters. If no such pair exists, return 0.

Leetcode 319: Bulb Switcher

There are n bulbs initially off. You toggle every ith bulb in the ith round, and at the end, you need to return how many bulbs remain on.