Solved! Leetcode 2616. Minimize the Maximum Difference of Pairs

source: https://leetcode.com/problems/minimize-the-maximum-difference-of-pairs/ Table of ContentsMinimize the Maximum Difference of PairsExample 1:Example 2:Constraints:Solution Minimize the Maximum Difference of Pairs You are given a 0-indexed integer array nums and an integer p. Find p pairs of indices of nums to minimize the maximum difference amongst all the pairs. Also, ensure no index appears more than once amongst ...

Solved! Leetcode 139. Word Break

source: https://leetcode.com/problems/word-break/ Table of ContentsWord BreakDescriptionExample 1:Example 2:Example 3:Constraints:Solution Word Break Description Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation. ...

Solved! Leetcode 920. Number of Music Playlists

source: https://leetcode.com/problems/number-of-music-playlists/ Table of ContentsNumber of Music PlaylistsDescriptionExample 1:Example 2:Example 3:Constraints:Solution Number of Music Playlists Description Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: Every song is played at least once. A song ...

Solved! Leetcode 1230. Toss Strange Coins

source: https://leetcode.com/problems/toss-strange-coins/description/ Toss Strange Coins Table of ContentsToss Strange CoinsDescriptionExample 1:Example 2:Constraints:Solution Description You have some coins. The i-th coin has a probability prob[i] of facing heads when tossed. Return the probability that the number of coins facing heads equals target if you toss every coin exactly once. Example 1: Input: prob = [0.4], target ...

Solved! Leetcode 1575. Count All Possible Routes

source: https://leetcode.com/problems/count-all-possible-routes/ Count All Possible Routes Description You are given an array of distinct positive integers locations where locations[i] represents the position of city i. You are also given integers start, finish and fuel representing the starting city, ending city, and the initial amount of fuel you have, respectively. At each step, if you are ...

Solved! Leetcode 1035. Uncrossed Lines

source: https://leetcode.com/problems/uncrossed-lines/description/ Uncrossed Lines You are given two integer arrays nums1 and nums2. We write the integers of nums1 and nums2 (in the order they are given) on two separate horizontal lines. We may draw connecting lines: a straight line connecting two numbers nums1[i] and nums2[j] such that: nums1[i] == nums2[j], and the line we ...

Solved! Leetcode 2466. Count Ways To Build Good Strings

source: https://leetcode.com/problems/count-ways-to-build-good-strings/description/ Count Ways To Build Good Strings Given the integers zero, one, low, and high, we can construct a string by starting with an empty string, and then at each step perform either of the following: Append the character ‘0’ zero times. Append the character ‘1’ one times. This can be performed any number ...

Solved Leetcode 2140. Solving Questions With Brainpower

source: https://leetcode.com/problems/solving-questions-with-brainpower/description/ Solving Questions With Brainpower You are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri]. The array describes the questions of an exam, where you have to process the questions in order (i.e., starting from question 0) and make a decision whether to solve or skip each question. Solving question ...

Solved! Leetcode 1312. Minimum Insertion Steps to Make a String Palindrome

source: https://leetcode.com/problems/minimum-insertion-steps-to-make-a-string-palindrome/description/ Minimum Insertion Steps to Make a String Palindrome Given a string s. In one step you can insert any character at any index of the string. Return the minimum number of steps to make s palindrome. A Palindrome String is one that reads the same backward as well as forward. Example 1: Input: ...

Solved! Leetcode 879. Profitable Schemes

source: https://leetcode.com/problems/profitable-schemes/description/ Profitable Schemes There is a group of n members, and a list of various crimes they could commit. The ith crime generates a profit[i] and requires group[i] members to participate in it. If a member participates in one crime, that member can’t participate in another crime. Let’s call a profitable scheme any subset ...