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 2024. Maximize the Confusion of an Exam

source: https://leetcode.com/problems/maximize-the-confusion-of-an-exam/description/ Table of ContentsMaximize the Confusion of an ExamDescriptionExample 1:Example 2:Example 3:Constraints:Solution Maximize the Confusion of an Exam Description A teacher is writing a test with n true/false questions, with ‘T’ denoting true and ‘F’ denoting false. He wants to confuse the students by maximizing the number of consecutive questions with the same answer ...

Solved! Leetcode 1150. Check If a Number Is Majority Element in a Sorted Array

source: https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array/description/ Check If a Number Is Majority Element in a Sorted Array Table of ContentsCheck If a Number Is Majority Element in a Sorted ArrayDescriptionExample 1:Example 2:Constraints:Solution Description Given an integer array nums sorted in non-decreasing order and an integer target, return true if target is a majority element, or false otherwise. A majority ...

Solved! Leetcode 744. Find Smallest Letter Greater Than Target

source: https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/ Find Smallest Letter Greater Than Target Table of ContentsFind Smallest Letter Greater Than TargetDescriptionExample 1:Example 2:Example 3:Constraints:Solution Description You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Return the smallest character in letters that is ...

Solved! Leetcode 881. Boats to Save People

source: https://leetcode.com/problems/boats-to-save-people/description/ Boats to Save People You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of ...

Solved! 875. Koko Eating Bananas

Table of ContentsProblem Description : Koko Eating BananasExamplesConstraintsPython Problem Description : Koko Eating Bananas source: https://leetcode.com/problems/koko-eating-bananas/  Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko can decide her bananas-per-hour eating speed of k. Each hour, she chooses some pile of bananas and eats k bananas from ...

Solved! Leetcode 1055. Shortest Way to Form String

source: https://leetcode.com/problems/shortest-way-to-form-string/description/ Shortest Way to Form String A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., “ace” is a subsequence of “abcde” while “aec” is not). Given two strings ...

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 1533: Find the Index of the Large Integer

https://leetcode.com/problems/find-the-index-of-the-large-integer/description/ We have an integer array arr, where all the integers in arr are equal except for one integer, which is larger than the rest of the integers. You will not be given direct access to the array. Instead, you will have an API ArrayReader which have the following functions: int compareSub(int l, int r, int x, int y): where 0 <= l, r, ...

Solved! Leetcode 1428: Leftmost Column with at Least a One

A row-sorted binary matrix means that all elements are 0 or 1 and each row of the matrix is sorted in non-decreasing order.Given a row-sorted binary matrix binaryMatrix, return the index (0-indexed) of the leftmost column with a 1 in it. If such an index does not exist, return -1.You can’t access the Binary Matrix ...