Count the value occurrences

Report a typo

Implement a method that takes an integer value and two lists of numbers. It must check if the value occurs the same number of times in both sequences.

Keep note however that you do not need to input any data yourself. The values are provided via arguments to the method checkTheSameNumberOfTimes for this task.

In the following example, the first line contains the value, the second line is the first list, the third line is another list.

All numbers are separated by whitespaces.

Sample Input 1:

3
8 8 3 3 2
1 3 3 2

Sample Output 1:

true

Sample Input 2:

3
9 8 4 3 2
1 3 3 3

Sample Output 2:

false
Write a program in Java 17
class Counter {

public static boolean checkTheSameNumberOfTimes(int elem, List<Integer> list1, List<Integer> list2) {
// implement the method
// there is no need to input data from the command line
// instead, use arguments elem, list1 and list2
return false;
}
}
___

Create a free account to access the full topic