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 1255. Maximum Score Words Formed by Letters

source: https://leetcode.com/problems/maximum-score-words-formed-by-letters/description/ Maximum Score Words Formed by Letters Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words formed by using the given letters (words[i] cannot be used two or more times). It is not necessary to use ...

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

Solved! Leetcode 1641. Count Sorted Vowel Strings

source: https://leetcode.com/problems/count-sorted-vowel-strings/description/ Count Sorted Vowel Strings Given an integer n, return the number of strings of length n that consist only of vowels (a, e, i, o, u) and are lexicographically sorted. A string s is lexicographically sorted if for all valid i, s[i] is the same as or comes before s[i+1] in the alphabet. ...

Solved! Leetcode 369. Plus One Linked List

source: https://leetcode.com/problems/plus-one-linked-list/description/ Plus One Linked List Given a non-negative integer represented as a linked list of digits, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list. Example 1: Input: head = [1,2,3] Output: [1,2,4] Example 2: Input: head = [0] Output: [1] ...

Solved! Leetcode 2187. Minimum Time to Complete Trips

Table of ContentsProblem StatementJavaPython Problem Statement source: https://leetcode.com/problems/minimum-time-to-complete-trips/description/ You are given an array time where time[i] denotes the time taken by the ith bus to complete one trip. Each bus can make multiple trips successively; that is, the next trip can start immediately after completing the current trip. Also, each bus operates independently; that is, ...

Solved! Leetcode 438: Find All Anagrams in a String

source: https://leetcode.com/problems/find-all-anagrams-in-a-string/description/ An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Given two strings s and p, return an array of all the start indices of p’s anagrams in s. You may return the answer in any order. ...

Solved! Leetcode 2361: Minimum Costs Using the Train Line

source: https://leetcode.com/problems/minimum-costs-using-the-train-line/ A train line going through a city has two routes, the regular route and the express route. Both routes go through the same n + 1 stops labeled from 0 to n. Initially, you start on the regular route at stop 0. You are given two 1-indexed integer arrays regular and express, both ...