Number System Solution

Yesterday I used a programming challenge to illustrate a use of generators. The solution to the problem given in that post was far from ideal – just a brute force hack, really. Today, let’s look at a respectable solution to the problem. Again, the problem: Imagine you are given a set of weights, each weight…

When Generators Are Brute Force Enablers

An interesting (if mysterious) programming challenge popped up in my business partner’s browser the other day. You’re given an odd set of weights which represents the series of powers of three. So, the first one is 1lb, the second 3lbs, the third 9lbs, the fourth 27lbs, etc. You also have a scale. If someone puts…