Practice
Count Occurrences
HARDArrays
Read N (1 ≤ N ≤ 10), then N integers, then a target value. Output how many times the target appears in the array.
Input: N, then N integers, then the target. Output: The count of occurrences.
Example:
Input: 5
3 5 3 5 3
3
Output: 3
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Target appears 3 times
Inputs: 5, 3, 5, 3, 5, 3, 3
Expected: 3
Test 2: Target appears twice
Inputs: 4, 1, 2, 1, 3, 1
Expected: 2
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade