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

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: # Your task is to complete this function

# Function should return an integer

def num(arr, n, k):

    # Code here



Solutions:
def num(arr, n, k):
	arr = list(map(str, arr))
	arr = ''.join(arr)
	return arr.count(str(k))


def num(arr, n, k):
	l = ''
	count = 0
	for i in range(n):
		l += str(arr[i])
	for j in l:
		if int(j) == k:
			count += 1
		else:
			continue
	return count


def num(arr, n, k):
	count = 0
	for i in arr:
		count += str(i).count(str(k))
	return count


def num(arr, n, k):
	st = ''
	for num in arr:
		st += str(num)
	return st.count(str(k))


def num(arr, n, k):
	s = ''
	for i in arr:
		s += str(i)
	return s.count(str(k))


def num(arr, n, k):
	c = 0
	for i in range(len(arr)):
		a = arr[i]
		while a > 0:
			rem = a % 10
			if rem == k:
				c += 1
			a = a // 10
	return c


def num(arr, n, k):
	i = 0
	count = 0
	while i < n:
		num = arr[i]
		for j in range(len(str(num))):
			rem = num % 10
			num = num // 10
			if rem == k:
				count = count + 1
		i = i + 1
	return count


def num(arr, n, k):
	u = 0
	for i in range(0, n):
		r = arr[i]
		while r > 0:
			e = r % 10
			r = r // 10
			if e == k:
				u = u + 1
	return u


def num(arr, n, k):
	arr = [x for x in str(arr)]
	k = str(k)
	count = 0
	for i in range(len(arr)):
		if arr[i] == k:
			count += 1
	return count


def num(arr, n, k):
	return str(arr).count(str(k))


def num(arr, n, k):
	cnt = 0
	for i in arr:
		for j in str(i):
			if j == str(k):
				cnt += 1
	return cnt


def num(arr, n, k):
	count = 0
	arr_str = ' '.join(map(str, arr))
	for i in arr_str:
		if i == str(k):
			count += 1
	return count


def num(arr, n, k):
	digit_count = 0
	for i in arr:
		while i:
			num = i % 10
			if num == k:
				digit_count += 1
			i = i // 10
	return digit_count


def num(arr, n, k):
	s1 = ''.join((str(i) for i in arr))
	count = 0
	for j in s1:
		if str(k) == j:
			count += 1
	return count


def num(arr, n, k):
	cou = 0
	for i in arr:
		if str(k) in str(i):
			g = str(i).count(str(k))
			cou += g
	return cou


def num(arr, n, k):
	string = []
	for i in str(arr):
		string.append(i)
	return string.count(str(k))


def num(arr, n, k):
	c = 0
	for i in arr:
		s = str(i)
		for j in s:
			if int(j) == k:
				c += 1
	return c


def num(arr, n, k):
	count = 0
	for i in arr:
		while i > 0:
			if i == k:
				count += 1
			else:
				r = i % 10
				if r == k:
					count += 1
			i = i // 10
	return count


def num(arr, n, k):
	a = list(map(str, arr))
	string = ''.join(a)
	k = str(k)
	ans = string.count(k)
	return ans


def num(arr, n, k):
	flag = 0
	for x in arr:
		temp = str(x)
		if temp.count(str(k)) > 0:
			flag += temp.count(str(k))
	return flag


def num(arr, n, k):
	count = 0
	for i in arr:
		a = list(str(i))
		for j in a:
			if j == str(k):
				count += 1
	return count


def num(arr, n, k):
	str1 = ''
	str2 = str(k)
	count = 0
	for i in range(n):
		str1 += str(arr[i])
	for chr in str1:
		if chr == str2:
			count += 1
	return count


def num(arr, n, k):
	count = 0
	for i in range(len(arr)):
		b = str(arr[i])
		for n in enumerate(b):
			if n[1] == str(k):
				count = count + 1
	return count


def num(arr, n, k):
	arr = map(str, arr)
	string = ''.join(arr)
	return string.count(str(k))


def num(arr, n, k):
	c = 0
	for i in range(n):
		while arr[i] != 0:
			if arr[i] % 10 == k:
				c += 1
			arr[i] = arr[i] // 10
	return c


def num(arr, n, k):
	a = []
	for i in arr:
		x = str(i)
		a += [*x]
	count = 0
	for i in a:
		if i == str(k):
			count += 1
	return count


def num(arr, n, k):
	lst = []
	for i in arr:
		lst.append(str(i))
	st = ''.join(lst)
	tot_count = 0
	for i in st:
		if i == str(k):
			tot_count += 1
	return tot_count


def num(a, n, k):
	count = 0
	for i in a:
		if str(k) in str(i):
			n = str(i).count(str(k))
			count += n
	return count


def num(arr, n, k):
	a = 0
	for i in arr:
		while i != 0:
			d = i % 10
			if d == k:
				a = a + 1
			i = i // 10
	return a


def num(arr, n, k):
	count = 0
	for num in arr:
		while num > 0:
			if num % 10 == k:
				count += 1
			num //= 10
	return count


def num(arr, n, k):
	count = 0
	for i in arr:
		i = str(i)
		if len(i) > 1:
			for j in i:
				if j == str(k):
					count += 1
		elif str(i) == str(k):
			count += 1
	return count


def num(arr, n, k):
	res = 0
	for i in range(len(arr)):
		arr[i] = str(arr[i])
		if str(k) in arr[i]:
			res += arr[i].count(str(k))
	return res


def num(arr, n, k):
	arr = [str(i) for i in arr]
	arr = ''.join(arr)
	count = arr.count(str(k))
	return count


def num(arr, n, k):
	a = ' '
	for i in arr:
		a += str(i)
	b = 0
	for i in a:
		if i == str(k):
			b += 1
	return b


def num(arr, n, k):
	(str_arr, count) = ('', 0)
	for i in arr:
		str_arr += str(i)
	for i in str_arr:
		if i == str(k):
			count += 1
	return count


def num(arr, n, k):
	st = [str(i) for i in arr]
	s = ''.join(st)
	count = 0
	for i in s:
		if int(i) == k:
			count += 1
	return count


def num(arr, n, k):
	c = 0
	m = str(k)
	for i in range(len(arr)):
		s = str(arr[i])
		for i in s:
			if i == m:
				c += 1
	return c


def num(arr, n, k):
	out = ''.join(map(str, arr))
	cnt = 0
	for ch in out:
		if ch == str(k):
			cnt += 1
	return cnt


def num(arr, n, k):
	l = []
	for i in arr:
		while i > 0:
			if i % 10 == k:
				l.append(i % 10)
			i = i // 10
	return len(l)


def num(arr, n, k):
	co = 0
	for i in range(n):
		for j in str(arr[i]):
			if str(k) == j:
				co += 1
	return co


def num(arr, n, k):
	c = []
	for i in arr:
		p = str(i)
		for i in range(len(p)):
			c.append(int(p[i]))
	return c.count(k)


def num(arr, n, k):
	count = 0
	for i in range(n):
		digit = str(k)
		s = str(arr[i])
		for j in range(len(s)):
			if digit in s[j]:
				count = count + 1
			else:
				continue
	return count


def num(arr, n, k):
	tot = 0
	for i in range(len(arr)):
		tot += str(arr[i]).count(str(k))
	return tot


def num(arr, n, k):
	arr = ''.join([str(x) for x in arr])
	if str(k) in arr:
		return arr.count(str(k))
	else:
		return 0


def num(arr, n, k):
	z = 0
	for a in range(len(arr)):
		output = [int(x) for x in str(arr[a])]
		for e in range(len(output)):
			if output[e] == k:
				z = z + 1
	return z


def num(arr, n, k):
	counter = 0
	l = str(k)
	m = str(arr)
	for i in m:
		if i == l:
			counter += 1
	return counter


def num(arr, n, k):
	L = map(str, arr)
	C = 0
	for i in L:
		C += i.count(str(k))
	return C