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 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 1129: Shortest Path with Alternating Colors

source: https://leetcode.com/problems/shortest-path-with-alternating-colors/ You are given an integer n, the number of nodes in a directed graph where the nodes are labeled from 0 to n – 1. Each edge is red or blue in this graph, and there could be self-edges and parallel edges. You are given two arrays redEdges and blueEdges where: redEdges[i] = ...

Solved! Leetcode 2477. Minimum Fuel Cost to Report to the Capital

source: https://leetcode.com/problems/minimum-fuel-cost-to-report-to-the-capital/description/ There is a tree (i.e., a connected, undirected graph with no cycles) structure country network consisting of n cities numbered from 0 to n – 1 and exactly n – 1 roads. The capital city is city 0. You are given a 2D integer array roads where roads[i] = [ai, bi] denotes that ...

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