From b0758af333641d3a688e206226091679b57775c5 Mon Sep 17 00:00:00 2001 From: lordoj <55106732+lordoj@users.noreply.github.com> Date: Tue, 21 Jul 2020 13:18:39 -0400 Subject: [PATCH] Week 8 Problem 2 --- Oj-Bademosi.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Oj-Bademosi.py diff --git a/Oj-Bademosi.py b/Oj-Bademosi.py new file mode 100644 index 0000000..b4afb13 --- /dev/null +++ b/Oj-Bademosi.py @@ -0,0 +1,36 @@ +#Problem 2 +from collections import Counter + +#accept the number of integers + +n = int(input()) + +#accept the integers , this will create list of the input values + +a = list(map(int,input().split())) + +#acepst the value of k + +k = int(input()) + +#this will create a frequenct distribution dictionary + +#key will be the values and value will be the number of times they occur + +c = Counter(a) + +ans_list = [] + +#now iterate over this collectiosn and findall which ahve k as the frequency + +for i in c.items(): + + # if frequency is same as k append it to list + + if i[1]==k: + + ans_list.append(i[0]) + +#finally print the min value in list + +print(min(ans_list))