Count Target
L1 Easy Arrays & Hashing
Counting how often a specific value appears is a loop plus an equality check. Equal-to comparisons are the core of most counting work.
Count how many times target appears inside nums, then return that count.
Examples
▸ nums = [1, 2, 3, 2, 2], target = 2
→ 3
▸ nums = [], target = 5
→ 0
▸ nums = [4, 4, 4], target = 4
→ 3