All Posts

Leetcode 1616: Split Two Strings to Make Palindrome

You are given two strings, a and b, of the same length. You need to split both strings at the same index into two parts: one prefix and one suffix for each string. Then, check if concatenating one prefix from one string with the suffix of the other string forms a palindrome. Specifically, you need to check if either aprefix + bsuffix or bprefix + asuffix forms a palindrome.

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 1621: Number of Sets of K Non-Overlapping Line Segments

You are given n points on a 1-D plane, where each point i is at x = i. Your task is to find the number of ways to draw exactly k non-overlapping line segments that cover two or more points, such that the endpoints are integral. Return the result modulo 10^9 + 7.

Leetcode 1625: Lexicographically Smallest String After Applying Operations

Given a string s of even length consisting of digits from 0 to 9, and two integers a and b, return the lexicographically smallest string that can be obtained by applying two operations any number of times: adding a to all odd indices of s (with wrapping) and rotating s to the right by b positions.

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.