From 33be3cfdb3c1f42beae2f7b8c94cbba404e85bf6 Mon Sep 17 00:00:00 2001 From: ekene966 <47493566+ekene966@users.noreply.github.com> Date: Tue, 21 Jul 2020 15:25:29 -0400 Subject: [PATCH] Create Ekene_Uzoegwu.py --- week-8/Python/Ekene_Uzoegwu.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 week-8/Python/Ekene_Uzoegwu.py diff --git a/week-8/Python/Ekene_Uzoegwu.py b/week-8/Python/Ekene_Uzoegwu.py new file mode 100644 index 0000000..7b9cc71 --- /dev/null +++ b/week-8/Python/Ekene_Uzoegwu.py @@ -0,0 +1,25 @@ +#solution 2 +n=int(input()) +arr=list(map(int,input().split())) +arr.sort() +k=int(input()) +# s=set(arr) +sol_n=[0]*len(arr) +for i in arr: + sol_n[i]=+sol_n[i]+1 + if sol_n[i]==k: + print(i) + break + +#solution 1 +from bisect import bisect_left as bleft +from itertools import accumulate as accm + +n,q=map(int,input().split()) + +num_stones=list(map(int,input().split())) +summed=list(accm(num_stones)) + +queries=list(map(int,input().split()))[:q] + +for i in queries: print(bleft(summed,i)+1)