Pergunta de entrevista da empresa Alarm.com

The bit-shifting problem had me thinking for a while, but I got it with some prodding.