50. Count Occurrences
Foundation1000 ms256 MBSolved by 0%
You are given an array of n integers and then a value k on its own line.
Print how many times k appears in the array.
Constraints - `1 ≤ n ≤ 100000` - `-1000000 ≤ a[i], k ≤ 1000000`
Input
The first line contains an integer n.
The second line contains n space-separated integers.
The third line contains an integer k.
Output
Print one integer — how many times k appears.
Input6
1 2 2 3 2 4
2
Output3
Notehas the value appearing three times
Input4
1 2 3 4
9
Output0
Notedoes not contain the value at all
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution