All Posts
Leetcode 1871: Jump Game VII
s
and two integers minJump
and maxJump
. Initially, you are at index 0
of the string s
, which is guaranteed to be ‘0’. You can move from index i
to index j
if: i + minJump <= j <= min(i + maxJump, s.length - 1), and s[j] == ‘0’. Return true
if it’s possible to reach the last index of the string (s.length - 1
), or false
otherwise.
You are given a binary string Leetcode 1877: Minimize Maximum Pair Sum in Array
nums
of even length n
, your task is to pair up the elements of the array into n / 2
pairs such that the maximum pair sum is minimized. A pair sum is defined as the sum of two elements in a pair. The goal is to minimize the largest of these pair sums.
Given an array Leetcode 1878: Get Biggest Three Rhombus Sums in a Grid
m x n
matrix grid
. A rhombus sum refers to the sum of the elements that form the border of a rhombus shape. The rhombus should be viewed as a square rotated 45 degrees, with each of its corners centered on a grid cell. Compute the biggest three distinct rhombus sums in the grid and return them in descending order. If there are fewer than three distinct sums, return all of them.
You are given an Leetcode 1882: Process Tasks Using Servers
servers
and tasks
. The servers
array represents the weights of the servers, and the tasks
array represents the processing times of tasks. Tasks are assigned to servers based on the smallest server weight and index. If no server is available, tasks wait for a server to become free.
You are given two integer arrays, Leetcode 1887: Reduction Operations to Make the Array Elements Equal
Given an integer array nums, the task is to perform operations until all elements in the array are the same. In each operation, identify the largest element in the array, find the next largest value strictly smaller than the current largest, and reduce the largest element to that value. The goal is to count how many operations are required to make all elements in the array equal.
Leetcode 1888: Minimum Number of Flips to Make the Binary String Alternating
You are given a binary string s consisting of ‘0’s and ‘1’s. You can perform two operations on the string:
- Type-1: Move the first character of the string to the end.
- Type-2: Flip the value of any character in the string (‘0’ becomes ‘1’ and ‘1’ becomes ‘0’). The goal is to make the string alternating, i.e., no two adjacent characters should be the same. You need to find the minimum number of type-2 operations required to make the string alternating.