Wiley interview question

String traversal problem and basic bit manipulation.