All Posts

Leetcode 198: House Robber

You are a burglar planning to rob houses along a street. Each house has an amount of money, but robbing two adjacent houses will trigger an alarm. Given an integer array nums representing the money stashed in each house, find the maximum amount you can rob without triggering the alarm.

Leetcode 213: House Robber II

You are tasked with designing a strategy to rob houses along a circular street, where no two adjacent houses can be robbed on the same night. The goal is to maximize the total money stolen without triggering security alarms.

Leetcode 279: Perfect Squares

Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is a number that is the square of an integer. Your goal is to determine the minimum number of perfect squares that sum up to the given integer n.

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 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.