Equal Levels Two signals are being generated as part of a simulation. A program monitors the signals. Whenever the two signals become equal at the same time, the frequency is noted. A record is maintained for the maximum simultaneous frequency seen so far. Each time a higher simultaneous frequency is noted, this variable (maxequal) is updated to the higher frequency. Note: . Both signals start at time t-o, but their durations might be different. In this case, the comparison of equality is performed only until the end of the shorter signal. • If both signals have equal frequencies at a given time but the frequency is less than or equal to the current maximum frequency, maxequal, is not updated. The running times of both signals are given, denoted by n and mrespectively. During the course of the simulation, how many times is the maxequal variable updated? Example signalone = 11. 2. 3. 3.3.5.41 signalTwo = [1, 2, 3, 4, 3, 5, 4) 5 ~Signal 1 ~ Signal 2 Frerquency maxequal updated Output - 4 (maxequal was updated 4 times) 1 2 3 4 5 6 7 Time Each of the first three signals match and are increasing, so maxequalis updated 3 times to 1, 2 and then 3. At the fourth time, they are not equal. At the fifth, they are equal to 3. Since maxequal contains 3 already, it is not updated. At the sixth time, both signals are equal to 5. This is greater than maxequal = 3, so now maxequal = 5. At the final time, signals are equal to 4. Since 4 is less than maxequal, it is not updated. maxEqual was updated a total of 4 times. Function Description Complete the update Times function in the editor below. updateTimes has the following parameter(s): int signalone[n]: the frequencies of the first signal int signalTwo[m]: the frequencies of the second signal Return int: the number of updates Constraints • 1 ss 10 . Os signalOne[i] = 109 • 1 sms 105 Os signalTwo[i] = 109 Sample Case 1 Sample Input For Custom Testing STDIN Function 5 → signalone[] size n = 5 signalone = [1, 2, 3, 4, 5] → 1 2 4 5 → signalTwo[] size m = 5 signalTwo = [5, 4, 3, 2, 1] 4 3 2 1 Sample Output 1 Explanation 5 ~Signal 1 4 ~Signal 2 3 Frerquency maxequal updated 1 Output = 1 (maxequal was updated 1 time) 1 2 3 4 5 6 7 Time The maximum frequency is updated once at 3, the only point where the signals match. Language Java 7 Autocomplete Ready O ? 4 HNM in G 1 import java.io.*; import java.math.*; import java.security.*; import java.text.*; 5 import java.util.; 6 import java.util.concurrent.*; 7 import java.util.regex.*; 8 9 10 class Result i 11 12 13 * Complete the 'updateTimes' function below. 14 15 * The function is expected to return an INTEGER. 16 * The function accepts following parameters: 1. INTEGER_ARRAY signalone 18 2. INTEGER_ARRAY signalTwo 19 20 21 public static int updateTimes (List signalone = new ArrayList<>(); for (int i = 0; i < signalOneCount; i++) { int signaloneItem = Integer.parseInt(buffered Reader.readLine().trim()); signalone.add(signaloneItem); } int signalTwoCount = Integer.parseInt(bufferedReader.readLine().trim(); 45 List signalTwo = new ArrayList<>(); for (int i = 0; i < signalTwoCount; i++) { int signalTwoItem = Integer.parseInt(buffered Reader.readLine().trim()); signalTwo.add(signalTwoItem); } 46 47 48 49 50 51 52 53 54 int result = Result.updateTimes (signalone, signalTwo); bufferedWriter.write(String.valueof(result)); bufferedWriter.newLine(); 55 bufferedReader.close(); bufferedWriter.close(); 56 57 58 )