Solution (source code)

= Solution

\b[Yes], for a nonnegative integer $g$: the closed <orientable surface> of <genus> $g$ has precisely these groups. A standard polygon cell structure has one vertex, $2g$ one-cells and one two-cell attached by a product of commutators. Its integral cellular boundary maps are zero, because each generator occurs once in each <orientation> in the attaching word. Thus $H_0=H_2=\mathbb Z$ and $H_1=\mathbb Z^{2g}$. At <genus> zero use the sphere.