Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.18 KB

File metadata and controls

24 lines (18 loc) · 1.18 KB

Find Number of Numbers

Easy

Given an array A[]  of n elements. Your task is to complete the Function num which returns an integer denoting the total number of times digit k appears in the whole array.

For Example:

Input:
A[] = {11,12,13,14,15}, k=1
Output:
6 
Explanation: Here digit 1 appears in the whole array 6 times.

Your Task:

You don't need to read input or print anything. Complete the function Num() which accepts an integer N and array A as input parameter and return the desired output.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Constraints:
1<=T<=100
1<=n<=20
1<=A[]<=1000