Wiley Interview Question

String traversal problem and basic bit manipulation.