← 返回 ibm 的题目列表Count Frequencies Within All Given Frequency Ranges
类型:online_judge
ibm
There are n signal frequencies given in an array frequencies, along with m frequency ranges provided in an array ranges. Your task is to count the number of signal frequencies that satisfy all the frequency range conditions.
Input:
An integer array frequencies, where frequencies[i] represents the frequency of the i-th signal.
An array ranges, where ranges[j] = [low_j, high_j] represents a frequency range.
Output:
An integer, representing the count of frequencies satisfying all frequency range conditions.
Constraints:
1 <= n <= 10^5
1 <= m <= 10^5
0 <= frequencies[i] <= 10^9
0 <= low_j <= high_j <= 10^9
Example:
Input: frequencies = [15, 25, 35, 45] ranges = [[20, 30], [40, 50]] Output: 2
Example
Input
15 25 35 45
2
20 30
40 50