3008. Find Beautiful Indices in the Given Array II
You are given a 0-indexed string
s, a stringa, a stringb, and an integerk.An index
iis beautiful if:
0 <= i <= s.length - a.length
s[i..(i + a.length - 1)] == aThere exists an index
1 jsuch that:
0 <= j <= s.length - b.lengths[j..(j + b.length - 1)] == b|j - i| <= kReturn the array that contains beautiful indices in sorted order from smallest to largest.
3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K
You are given an integer
kand an integerx.Consider
sis the 1-indexed binary representation of an integernum. The price of a numbernumis the number ofi‘s such thati % x == 0ands[i]is a set bit.Return the greatest integer
numsuch that the sum of prices of all numbers from1tonumis less than or equal tok.Note:
- In the binary representation of a number set bit is a bit of value
1.- The binary representation of a number will be indexed from right to left. For example, if
s == 11100,s[4] == 1ands[2] == 0.
3006. Find Beautiful Indices in the Given Array I
You are given a 0-indexed string
s, a stringa, a stringb, and an integerk.An index
iis beautiful if:
0 <= i <= s.length - a.length
s[i..(i + a.length - 1)] == aThere exists an index
1 jsuch that:
0 <= j <= s.length - b.lengths[j..(j + b.length - 1)] == b|j - i| <= kReturn the array that contains beautiful indices in sorted order from smallest to largest.
3005. Count Elements With Maximum Frequency
You are given an array
numsconsisting of positive integers.Return the total frequencies of elements in
numssuch that those elements all have the maximum frequency.The frequency of an element is the number of occurrences of that element in the array.