Solved! Leetcode 1402. Reducing Dishes

Table of ContentsProblem DescriptionReducing DishesJavaPython Problem Description source: https://leetcode.com/problems/reducing-dishes/description/ Reducing Dishes A chef has collected data on the satisfaction level of his n dishes. Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its ...

Solved! Leetcode 120. Triangle

Table of ContentsProblem DescriptionTriangleJavaPython Problem Description source: https://leetcode.com/problems/triangle/description/ Triangle Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i ...

Solved! Leetcode 568. Maximum Vacation Days

source: https://leetcode.com/problems/maximum-vacation-days/ Maximum Vacation Days LeetCode wants to give one of its best employees the option to travel among n cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some particular cities and weeks. Your job is to schedule the traveling to maximize ...

Solved! Leetcode: 1029. Two City Scheduling

source: https://leetcode.com/problems/two-city-scheduling/description/ Two City Scheduling A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti], the cost of flying the ith person to city a is aCosti, and the cost of flying the ith person to city b is bCosti. Return the minimum cost to fly every person ...

Solved! Leetcode 646. Maximum Length of Pair Chain

source: https://leetcode.com/problems/maximum-length-of-pair-chain/description/ Maximum Length of Pair Chain You are given an array of n pairs pairs where pairs[i] = [lefti, righti] and lefti < righti. A pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A chain of pairs can be formed in this fashion. Return the length ...

Solved! Leetcode 320. Generalized Abbreviation

source: https://leetcode.com/problems/generalized-abbreviation/description/ Generalized Abbreviation A word’s generalized abbreviation can be constructed by taking any number of non-overlapping and non-adjacent substrings and replacing them with their respective lengths. For example, "abcde" can be abbreviated into: "a3e" ("bcd" turned into "3") "1bcd1" ("a" and "e" both turned into "1") "5" ("abcde" turned into "5") "abcde" (no substrings ...

Solved! Leetcode 638. Shopping Offers

source: https://leetcode.com/problems/shopping-offers/description/ Shopping Offers In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price. You are given an integer array price where price[i] is the price of the ...

Solved Leetcode 474. Ones and Zeroes

source: https://leetcode.com/problems/ones-and-zeroes/description/ Ones and Zeroes You are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0’s and n 1’s in the subset. A set x is a subset of a set y if all ...

Solved! Leetcode 1463. Cherry Pickup II

Solved! Leetcode 1463. Cherry Pickup II
source: https://leetcode.com/problems/cherry-pickup-ii/description/ Cherry Pickup II You are given a rows x cols matrix grid representing a field of cherries where grid[i][j] represents the number of cherries that you can collect from the (i, j) cell. You have two robots that can collect cherries for you: Robot #1 is located at the top-left corner (0, 0), ...

Solved! Leetcode 2431. Maximize Total Tastiness of Purchased Fruits

source: https://leetcode.com/problems/maximize-total-tastiness-of-purchased-fruits/description/ Maximize Total Tastiness of Purchased Fruits You are given two non-negative integer arrays price and tastiness, both arrays have the same length n. You are also given two non-negative integers maxAmount and maxCoupons. For every integer i in range [0, n – 1]: price[i] describes the price of ith fruit. tastiness[i] describes the ...