Count occurrences
Java
Easy
4 views
Problem Description
Task: return how many times target appears in array.
Output Format
Return value
Official Solution
static int count(int[] a,int target){int c=0;for(int x:a) if(x==target) c++;return c;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!