Pregunta de entrevista de Groupon

Bit manipution & an algorithm question about string.