All Posts

Leetcode 1605: Find Valid Matrix Given Row and Column Sums

You are given two arrays representing the sum of elements in each row and each column of a 2D matrix. The rowSum[i] represents the sum of the elements in the i-th row, and colSum[j] represents the sum of the elements in the j-th column. Your task is to find a matrix of non-negative integers that satisfies these row and column sum requirements.

Leetcode 1620: Coordinate With Maximum Network Quality

You are given an array of network towers, where each tower is represented by a list [xi, yi, qi] denoting its location (xi, yi) on the X-Y plane and its quality factor qi. You are also given a radius, and a tower is considered reachable if the distance between the tower and a coordinate is less than or equal to the radius. The signal quality of a tower at a coordinate (x, y) is calculated using the formula ⌊qi / (1 + d)⌋, where d is the Euclidean distance between the tower and the coordinate. The total network quality at a coordinate is the sum of the signal qualities from all the reachable towers. Your task is to find the coordinate with the maximum network quality. If multiple coordinates have the same network quality, return the lexicographically smallest coordinate.

Leetcode 1626: Best Team With No Conflicts

You are the manager of a basketball team, and you are tasked with selecting a team that maximizes the overall score. The score of the team is calculated by summing the individual scores of all the selected players. However, there is a rule: a conflict arises if a younger player has a strictly higher score than an older player. There is no conflict if players have the same age.

Leetcode 1630: Arithmetic Subarrays

A sequence of numbers is called arithmetic if it consists of at least two elements, and the difference between every two consecutive elements is the same. Given an array of integers nums and two arrays l and r representing m range queries, determine whether the subarray nums[l[i], ..., r[i]] can be rearranged to form an arithmetic sequence.

Leetcode 1631: Path With Minimum Effort

You are a hiker navigating a terrain represented by a 2D grid of heights. Your goal is to find the path from the top-left corner to the bottom-right corner that minimizes the maximum height difference between any two consecutive cells.

Leetcode 1637: Widest Vertical Area Between Two Points Containing No Points

Given n points on a 2D plane, where points[i] = [xi, yi], return the widest vertical area between two points such that no points are inside the area. A vertical area is defined as a fixed-width region that extends infinitely along the y-axis. The widest vertical area is the one with the maximum width. Note that points on the edge of the vertical area are not considered inside.