2935. Maximum Strong Pair XOR II
You are given a 0-indexed integer array
nums. A pair of integersxandyis called a strong pair if it satisfies the condition:
|x - y| <= min(x, y)You need to select two integers from
numssuch that they form a strong pair and their bitwiseXORis the maximum among all strong pairs in the array.Return the maximum
XORvalue out of all possible strong pairs in the arraynums.Note that you can pick the same integer twice to form a pair.
2934. Minimum Operations to Maximize Last Elements in Arrays
You are given two 0-indexed integer arrays,
nums1andnums2, both having lengthn.You are allowed to perform a series of operations (possibly none).
In an operation, you select an index
iin the range[0, n - 1]and swap the values ofnums1[i]andnums2[i].Your task is to find the minimum number of operations required to satisfy the following conditions:
nums1[n - 1]is equal to the maximum value among all elements ofnums1, i.e.,nums1[n - 1] = max(nums1[0], nums1[1], ..., nums1[n - 1]).nums2[n - 1]is equal to the maximum value among all elements ofnums2, i.e.,nums2[n - 1] = max(nums2[0], nums2[1], ..., nums2[n - 1]).Return an integer denoting the minimum number of operations needed to meet both conditions, or
-1if it is impossible to satisfy both conditions.
You are given a 2D 0-indexed array of strings,
access_times, with sizen. For eachiwhere0 <= i <= n - 1,access_times[i][0]represents the name of an employee, andaccess_times[i][1]represents the access time of that employee. All entries inaccess_timesare within the same day.The access time is represented as four digits using a 24-hour time format, for example,
"0800"or"2250".An employee is said to be high-access if he has accessed the system three or more times within a one-hour period.
Times with exactly one hour of difference are not considered part of the same one-hour period. For example,
"0815"and"0915"are not part of the same one-hour period.Access times at the start and end of the day are not counted within the same one-hour period. For example,
"0005"and"2350"are not part of the same one-hour period.Return a list that contains the names of high-access employees with any order you want.
2932. Maximum Strong Pair XOR I
You are given a 0-indexed integer array
nums. A pair of integersxandyis called a strong pair if it satisfies the condition:
|x - y| <= min(x, y)You need to select two integers from
numssuch that they form a strong pair and their bitwiseXORis the maximum among all strong pairs in the array.Return the maximum
XORvalue out of all possible strong pairs in the arraynums.Note that you can pick the same integer twice to form a pair.
2930. Number of Strings Which Can Be Rearranged to Contain Substring
You are given a 0-indexed
m * ninteger matrixvalues, representing the values ofm * ndifferent items inmdifferent shops. Each shop hasnitems where thejthitem in theithshop has a value ofvalues[i][j]. Additionally, the items in theithshop are sorted in non-increasing order of value. That is,values[i][j] >= values[i][j + 1]for all0 <= j < n - 1.On each day, you would like to buy a single item from one of the shops. Specifically, On the
dthday you can:
- Pick any shop
i.- Buy the rightmost available item
jfor the price ofvalues[i][j] * d. That is, find the greatest indexjsuch that itemjwas never bought before, and buy it for the price ofvalues[i][j] * d.Note that all items are pairwise different. For example, if you have bought item
0from shop1, you can still buy item0from any other shop.Return the maximum amount of money that can be spent on buying all
m * nproducts.