3018. Maximum Number of Removal Queries That Can Be Processed I
You are given a 0-indexed array
numsand a 0-indexed arrayqueries.You can do the following operation at the beginning at most once:
- Replace
numswith a subsequence ofnums.We start processing queries in the given order; for each query, we do the following:
- If the first and the last element of
numsis less thanqueries[i], the processing of queries ends.- Otherwise, we choose either the first or the last element of
numsif it is greater than or equal toqueries[i], and we remove the chosen element fromnums.Return the maximum number of queries that can be processed by doing the operation optimally.
3009. Maximum Number of Intersections on the Chart
There is a line chart consisting of
n``y. Thekthpoint has coordinates(k, y[k]). There are no horizontal lines; that is, no two consecutive points have the same y-coordinate.We can draw an infinitely long horizontal line. Return the maximum number of points of intersection of the line with the chart.
2992. Number of Self-Divisible Permutations
Given an integer
n, return the number of permutations of the 1-indexed arraynums = [1, 2, ..., n], such that it’s self-divisible.A 1-indexed array
aof lengthnis self-divisible if for every1 <= i <= n,gcd(a[i], i) == 1.A permutation of an array is a rearrangement of the elements of that array, for example here are all of the permutations of the array
[1, 2, 3]:
[1, 2, 3][1, 3, 2][2, 1, 3][2, 3, 1][3, 1, 2][3, 2, 1]
2979. Most Expensive Item That Can Not Be Bought
You are given two distinct prime numbers
primeOneandprimeTwo.Alice and Bob are visiting a market. The market has an infinite number of items, for any positive integer
xthere exists an item whose price isx. Alice wants to buy some items from the market to gift to Bob. She has an infinite number of coins in the denominationprimeOneandprimeTwo. She wants to know the most expensive item she can not buy to gift to Bob.Return the price of the most expensive item which Alice can not gift to Bob.
2964. Number of Divisible Triplet Sums
Given a 0-indexed integer array
numsand an integerd, return the number of triplets(i, j, k)such thati < j < kand(nums[i] + nums[j] + nums[k]) % d == 0.