Click here to see the full article post
I see from your equations that average(A) = average(B), but that is not consistent with the example solution.
average(A) = 4
average(B) & average(C) = 4.5
Am I missing something?
@rdubey Yeah you're missing .5 in average(A).
Oh that's embarrassing.
sum([1,2,3,4,5,6,7,8])/8 => 4 in python. Forgot the 8.0
Thanks for the nice pythonic version!!
Or you could use Python 3, which does division "right" :-)
Also wrote a Ruby version now which is short and fast.
instead of fractional arithmetic you can just transform A:
@PKryshtop Excellent. That makes the Python solution a lot faster, and the Java solution probably a lot easier and faster (I haven't tried it).
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.