Company: jpmc_12aug
Difficulty: medium
Count Signals Problem Description Signal filtering based on frequency is used to remove noise that lies outside a desired frequency range. Filters can be chained, and then a signal gets through only if its frequency lies inside the range of every filter. For instance, three filters with frequency ranges (10, 17) , (13, 15) and (13, 17) only let frequencies from 13 to 15 through, because that is the only range all three share. You are given the frequencies of n signals and a sequence of m filters. Filter i lets through every frequency from filterRanges[i][0] (its lower bound) to filterRanges[i][1] (its upper bound), both inclusive . All the filters share a single common range. Complete the function countSignals(frequencies, filterRanges) , which returns the number of signals that pass through all the filters. Input Format Read from standard input. n frequencies[0] frequencies[1] ... frequencies[n-1] m 2 filterRanges[0][0] filterRanges[0][1] ... filterRanges[m-1][0] filterRanges[m-1][1]