There’s a problem I have trouble solving. Shortly written, here’s how it goes:
There are N professors at a school, born in a certain year and you need to find the amount of years the professors share (if two professors share a year, it’s one year which is repeated).
Example: Input: (first line) 3 (second line) 1975 1960 1975 Output: (third line) 1
I’ve started somehow, and I have only managed to create the input:
int N;
cin >> N;
int array[N];
for (int i = 0; i < N; i++) {
cin >> array[i];
}
Now, I don’t know how to continue, or use the information (years) the user has entered.
Edit: Although there might be better ways of solving this, I am just looking for a simple solution, or a code explaining how I can continue this program.
Edit: It should display the amount of years which repeat.