Leaderboard
Showing:
Find the Frequency
Easy Accuracy: 59.48% Submissions: 11808 Points: 2

Given a vector of N positive integers and an integer X. The task is to find the frequency of X in vector.

 

Example 1:

Input:
N = 5
vector -> 1 1 1 1 1
X = 1
Output: 
8
Explanation: Frequency of 1 is 5.

Your Task:
Your task is to complete the function findFrequency() which should count the frequency of X and return it.

Video:

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Find the Frequency

Output Window