All Posts

Leetcode 2541: Minimum Operations to Make Array Equal II

You are given two integer arrays nums1 and nums2 of equal length n and an integer k. You can perform the following operation on nums1: Choose two indexes i and j and increment nums1[i] by k and decrement nums1[j] by k. The goal is to determine the minimum number of operations required to make nums1 equal to nums2. If it is impossible, return -1.

Leetcode 2542: Maximum Subsequence Score

You are given two integer arrays nums1 and nums2, both of size n, and a positive integer k. Your task is to select k indices from the array nums1, where the sum of the selected elements from nums1 is multiplied by the minimum element from the corresponding selected indices in nums2. The objective is to maximize this score.

Leetcode 2545: Sort the Students by Their Kth Score

You are given a matrix of scores, where each row represents a student and each column represents an exam. You need to sort the students based on their scores in the k-th exam, from the highest to the lowest. Return the sorted matrix.

Leetcode 2546: Apply Bitwise Operations to Make Strings Equal

You are given two binary strings s and target of the same length. You can perform an operation on s any number of times to transform it into target. The operation replaces two distinct indices with logical operations. Return true if it’s possible to make s equal to target, otherwise return false.

Leetcode 2550: Count Collisions of Monkeys on a Polygon

You are given a regular convex polygon with n vertices. Each vertex has one monkey. Every monkey can move either clockwise or anticlockwise to a neighboring vertex. A collision occurs if two monkeys land on the same vertex or cross paths on an edge. Your task is to return the number of ways the monkeys can move such that at least one collision happens, modulo 10^9 + 7.

Leetcode 2554: Maximum Number of Integers to Choose From a Range I

You are given an array banned consisting of integers, an integer n, and an integer maxSum. Your task is to return the maximum number of integers you can select from the range [1, n] such that none of them are in the banned list and their sum does not exceed maxSum.