All Posts

Leetcode 1865: Finding Pairs With a Certain Sum

You are given two integer arrays nums1 and nums2. Your task is to implement a data structure that supports two types of operations: 1) Add a value to an element in nums2. 2) Count the number of pairs (i, j) such that nums1[i] + nums2[j] equals a given total value.

Leetcode 1870: Minimum Speed to Arrive on Time

You are given a list of n train ride distances and a floating-point number hour which indicates the total time you have to reach your destination. You need to determine the minimum integer speed (in kilometers per hour) at which all the trains must travel to reach the office on time. If it is impossible, return -1.

Leetcode 1877: Minimize Maximum Pair Sum in Array

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

Leetcode 1878: Get Biggest Three Rhombus Sums in a Grid

You are given an 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.

Leetcode 1882: Process Tasks Using Servers

You are given two integer arrays, 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.

Leetcode 1886: Determine Whether Matrix Can Be Obtained By Rotation

You are given two n x n binary matrices mat and target. Your task is to determine if it is possible to rotate the matrix mat in 90-degree increments so that it matches the target matrix.