Optimize interrogation, add max_eq solution
This commit is contained in:
12
python/foobar/two/max_eq.py
Normal file
12
python/foobar/two/max_eq.py
Normal 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]
|
Reference in New Issue
Block a user