All Posts

Leetcode 2482: Difference Between Ones and Zeros in Row and Column

You are given an m x n binary matrix grid. You need to create a difference matrix diff where each element diff[i][j] is calculated by summing the number of ones and subtracting the number of zeros in the respective row and column.

Leetcode 2483: Minimum Penalty for a Shop

You are given a string representing the log of a shop’s customer visits over a series of hours. Each character in the string is either ‘Y’ (customer visits) or ‘N’ (no customer visits). The shop can close at any given hour, and the penalty is determined by two factors: when the shop is open but no customers visit, and when the shop is closed but customers still arrive. You need to determine the earliest hour at which the shop should close to minimize the penalty.

Leetcode 2486: Append Characters to String to Make Subsequence

You are given two strings, s and t, consisting only of lowercase English letters. Your task is to determine the minimum number of characters that need to be appended to the end of string s so that string t becomes a subsequence of s. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Leetcode 2487: Remove Nodes From Linked List

You are given the head of a linked list. Your task is to remove every node that has a node with a greater value to its right. The modified linked list should be returned after the removal of such nodes.

Leetcode 2491: Divide Players Into Teams of Equal Skill

You are given an array of integers representing the skill levels of players. You need to divide the players into pairs such that the sum of the skill levels of each pair is the same across all pairs. If it’s possible to form such pairs, return the sum of their chemistry, which is the product of the skill levels in each pair. If no such division is possible, return -1.

Leetcode 2492: Minimum Score of a Path Between Two Cities

You are given a set of cities, each connected by bidirectional roads. Each road has a distance, and the score of a path between two cities is defined as the minimum distance of any road on that path. The task is to find the minimum score of a path between city 1 and city n. You are allowed to visit the cities multiple times, and the roads may be repeated.