All Posts

Leetcode 1578: Minimum Time to Make Rope Colorful

Alice has a rope with balloons arranged in a sequence where each balloon has a color. She wants the rope to be colorful, meaning no two consecutive balloons should have the same color. Bob is tasked with helping Alice by removing some balloons. Each balloon has an associated cost, and Bob needs to minimize the total time spent removing the balloons to achieve the desired colorful sequence. Return the minimum time Bob needs to make the rope colorful.

Leetcode 1589: Maximum Sum Obtained of Any Permutation

You are given an array of integers nums and a list of requests, where each request specifies a range in the array. The ith request asks for the sum of all elements from nums[starti] to nums[endi], inclusive. Your task is to determine the maximum total sum of all requests for any permutation of nums.

Leetcode 1605: Find Valid Matrix Given Row and Column Sums

You are given two arrays representing the sum of elements in each row and each column of a 2D matrix. The rowSum[i] represents the sum of the elements in the i-th row, and colSum[j] represents the sum of the elements in the j-th column. Your task is to find a matrix of non-negative integers that satisfies these row and column sum requirements.

Leetcode 1642: Furthest Building You Can Reach

You are given an array heights representing the heights of buildings, along with a certain number of bricks and ladders. Your task is to determine the furthest building you can reach by optimally using bricks and ladders.

Leetcode 1647: Minimum Deletions to Make Character Frequencies Unique

Given a string s, determine the minimum number of deletions needed to make s ‘good’. A string is ‘good’ if no two characters have the same frequency.

Leetcode 1648: Sell Diminishing-Valued Colored Balls

You are given an inventory of different colored balls. The customer wants to buy a specific number of balls, and each ball has a value based on how many of that color are still available. Calculate the maximum total value you can obtain after fulfilling the customer’s order. The result should be returned modulo 10^9 + 7.