All Posts

Leetcode 2567: Minimum Score by Changing Two Elements

You are given an integer array nums. Your goal is to minimize the score of the array after changing exactly two elements. The score is the sum of the low and high scores, where the low score is the minimum absolute difference between any two integers and the high score is the maximum absolute difference between any two integers.

Leetcode 2568: Minimum Impossible OR

You are given a 0-indexed integer array nums. A number x is expressible from nums if there exists a subsequence of elements in nums whose bitwise OR equals x. Your task is to return the smallest positive integer that cannot be expressed as the bitwise OR of any subsequence from nums.

Leetcode 2571: Minimum Operations to Reduce an Integer to 0

You are given a positive integer n. You can perform the following operation any number of times: Add or subtract a power of 2 from n. Your goal is to find the minimum number of operations required to make n equal to 0.

Leetcode 2572: Count the Number of Square-Free Subsets

You are given a positive integer array nums. A subset of the array nums is square-free if the product of its elements is a square-free integer. A square-free integer is an integer that is not divisible by any perfect square other than 1. Return the number of square-free non-empty subsets of the array nums. Since the answer may be too large, return it modulo 10^9 + 7.

Leetcode 2575: Find the Divisibility Array of a String

Given a string word consisting of digits and an integer m, return an array where each element is 1 if the numeric value of the prefix word[0,…,i] is divisible by m, otherwise 0.

Leetcode 2576: Find the Maximum Number of Marked Indices

You are given a 0-indexed integer array nums. Initially, all indices are unmarked. You are allowed to perform the following operation any number of times: Pick two different unmarked indices i and j such that 2 * nums[i] <= nums[j], then mark both indices i and j. Return the maximum possible number of marked indices after performing this operation multiple times.