Solves a Google programming question in which a hypothetical scale must be balanced using weights with masses that  are only powers of 3