The k-beauty of a number is defined as the number of contiguous substrings of length k that are divisors of the original number when it is read as a string. Your task is to determine the k-beauty of a given number num.
You are given a string blocks consisting of the characters ‘W’ and ‘B’, where ‘W’ represents a white block and ‘B’ represents a black block. You are also given an integer k representing the desired length of consecutive black blocks. You can recolor white blocks to black in one operation. The task is to determine the minimum number of operations required to ensure there is at least one occurrence of k consecutive black blocks.
You are given an array nums consisting of positive integers. A subarray of nums is considered nice if the bitwise AND of every pair of elements, that are at different positions in the subarray, is equal to 0. Your task is to return the length of the longest nice subarray. A subarray is a contiguous part of an array, and subarrays of length 1 are always considered nice.
Given a 0-indexed array of non-negative integers, ’nums’, you need to find the length of the smallest subarray starting at each index that has the maximum possible bitwise OR. For each index ‘i’, find the minimum length subarray nums[i…j] such that the bitwise OR of this subarray equals the maximum OR value possible starting from index ‘i’.
You are given an array of integers and an integer k. You need to find the maximum sum of all possible subarrays of length k, where all elements in the subarray are distinct. If no subarray meets the condition, return 0.
You are given a string s consisting of the characters ‘a’, ‘b’, and ‘c’, and a non-negative integer k. Each minute, you can choose to take either the leftmost or the rightmost character from s. Your task is to determine the minimum number of minutes required to collect at least k occurrences of each character (‘a’, ‘b’, and ‘c’). If it is not possible to collect k of each character, return -1.