X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Find the Frequency
Easy Accuracy: 59.34% Submissions: 34535 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: 
5
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.

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