Optimize interrogation, add max_eq solution

This commit is contained in:
Orien Vandenbergh
2016-08-30 10:56:01 -06:00
parent 87f62712ea
commit 43241be2f3
3 changed files with 62 additions and 28 deletions

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python
samples = [ [[1,4,1],3], [[1,2],1] ]
def answer(x):
"""Find the number of cars that can be made an equal weight via bunny redistribution between cars"""
remainder = sum(x)%(len(x))
return len(x) if (remainder==0) else len(x)-1
for sample in samples:
print answer(sample[0])
print sample[1]