Groupon Interview Question

Bit manipution & an algorithm question about string.