GoDaddy Interview Question

Solve this programming exercise in 30 minutes.