Interesting "brute-force" solution -- we were looking for a more algorithmic approach, but this certainly works.