Time: 45mins
Question: Given an integer array that represents a list of package weights, return a list of weight transfer from package[i] to package[j] so that each package contains same weight of items.
input:
[6,20,18,12,4] // average weight is 12
output:
[
[1,0,6], // p[1] -> p[0] 6 lbs, p[0] = 12, p[1] = 14
[1,4,2], // p[1] -> p[4] 2 lbs, p[1] = 12, p[4] = 6
[2,4,6] // p[2] -> p[4] 6 lbs, p[2] = 12, p[4] = 12
]It's an easy question though, anyone knows if LC has similar one?