CT675

Urmila's Occurrence Count Ledger

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

At the quays of Driftwood, Urmila records each stamps in a worn leather ledger. The guild wants answers, not guesses. Task: Read n integers and a target x; print how many times x occurs. Input format: First line: n and x. Second line: n space-separated integers. Output format: Print the number of occurrences of x. Constraints: 1 <= n <= 26; 0 <= a[i],x <= 10.

Example 1:

Input: 9 0 3 2 0 10 8 1 8 5 0
Output: 2

Example 2:

Input: 9 0 9 4 0 6 5 9 2 4 1
Output: 1

Example 3:

Input: 4 4 2 7 9 8
Output: 0

Constraints:

1 <= n <= 26; 0 <= a[i],x <= 10.

Loading...
Test Cases:No test cases
No test cases available.