All Posts

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 1942: The Number of the Smallest Unoccupied Chair

In a party, there are n friends with distinct arrival and departure times. Each friend chooses the smallest available chair. The task is to determine the chair number where the friend numbered targetFriend will sit.

Leetcode 1962: Remove Stones to Minimize the Total

You are given an array of integers piles, where each element represents the number of stones in a pile, and an integer k. You need to perform the following operation exactly k times: Choose any pile, and remove floor(piles[i] / 2) stones from it. You can apply the operation to the same pile multiple times. The goal is to minimize the total number of stones left in all piles after performing the operation k times.

Leetcode 1985: Find the Kth Largest Integer in the Array

You are given an array of strings nums, where each string represents a non-negative integer. You need to find the kth largest integer in the array. Note that duplicates should be considered distinctly. For example, if the array is [‘1’, ‘2’, ‘2’], the first largest integer is ‘2’, the second largest is also ‘2’, and the third largest is ‘1’.

Leetcode 2034: Stock Price Fluctuation

You are given a stream of stock price records, where each record contains a timestamp and the corresponding price of the stock. The records may not be in order, and some records may contain errors that need to be corrected. Your task is to design an algorithm that updates the stock price at a given timestamp, finds the current price at the latest timestamp, and also finds the maximum and minimum prices the stock has been based on the current records.