Pergunta de entrevista da empresa General Motors (GM)

I had one on bit manipulation and a basic for-loop/string problem.