An accurate scale is one of the most important tools of the apothecary (an oldtime pharmacist).
To measure the weight of an object, the apothecary places the object on one
pan of the scale, along with some weights of known size, and adds more weights
of known size to the other pan until the scales balance. For example, if an object
weighs 17 grains, the apothecary could balance the scales by placing a 1grain weight
and a 9grain weight in the pan with the object, and a 27grain weight in the other
pan.
The apothecary owns weights in a range of sizes starting at 1 grain. In particular, he owns one weight for each
power of 3: 1 grain, 3 grains, 9 grains, 27 grains, etc. Determine, for an object weighing W grains, how to distribute the weights among the
pans to balance the object. This distribution will be unique. Return a int[] of the weights used. The sign of each weight should be
negative if the weight goes in the same pan as the object, and positive if it goes in the other pan. The int[] should be arranged in increasing order.
