We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
except 2 test cases all pass can any body help me with this code
from itertools import combinations as p
n = int(input())
s = sorted(input().split())
m = int(input())
a = list(p(s,m))
count = 0
for i in a :
if s[1] in i or s[0] in i:
count += 1
print(count/len(a))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Iterables and Iterators
You are viewing a single comment's thread. Return to all comments →
except 2 test cases all pass can any body help me with this code from itertools import combinations as p n = int(input()) s = sorted(input().split()) m = int(input()) a = list(p(s,m)) count = 0 for i in a : if s[1] in i or s[0] in i: count += 1 print(count/len(a))