All Posts

Leetcode 283: Move Zeroes

Given an integer array nums, move all the zeros to the end while maintaining the relative order of the non-zero elements. Perform the operation in-place without making a copy of the array.

Leetcode 287: Find the Duplicate Number

You are given an array nums of n + 1 integers where each integer is in the range [1, n]. The array contains exactly one duplicate number. Find and return this duplicate number without modifying the array and using constant extra space.

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 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 322: Coin Change

You are given a set of coins with different denominations and a target amount. Your task is to determine the fewest number of coins required to make the target amount. If it’s not possible, return -1.