Skip to content

Instantly share code, notes, and snippets.

@otherpirate
Created June 6, 2019 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otherpirate/85095f11b0f706a27dbcfc440f466bf3 to your computer and use it in GitHub Desktop.
Save otherpirate/85095f11b0f706a27dbcfc440f466bf3 to your computer and use it in GitHub Desktop.
#
# Complete the 'countTeams' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER_ARRAY skills
# 2. INTEGER k
# 3. INTEGER l
# 4. INTEGER r
#
def countTeams(skills, k, l, r):
count = 0
for v in skills:
if v >= l and v <= r:
count += 1
if count == 0:
return 0
if count == k:
return 1
total = 0
print(list(range(k, count+1)))
for p in range(k, count+1):
print(p, count, k)
print((count/p))
total += (count//p)
return int(total)
'''
1, 2, 3, 4, 5
1, 2
1, 3
1, 4
1, 5
2, 3
2, 4
2, 5
3, 4
3, 5
4, 5
= 10
1, 2, 3, 4, 5
1, 2, 3
1, 2, 4
1, 2, 5
1, 3, 4
1, 3, 5
1, 4, 5
2, 3, 4
2, 3, 5
2, 4, 5
3, 4, 5
= 10
1, 2, 3, 4, 5
1, 2, 3, 4
1, 2, 3, 5
1, 2, 4, 5
1, 3, 4, 5
2, 3, 4, 5
= 5
1, 2, 3, 4, 5
= 1
= 26'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment