Ported solution 7 to Objective-C.

The new solution shows some of the weaknesses of using primitive types
in Objective-C containers, and the result is around 2x slower, but it
was an interesting experience.