Your logic behind the question is absolutely perfect. I have no doubt in that. But your code will not work on some tricky test cases. In the test cases in which n(according to the question) will be divisible by 26, your code will not work.
Your code will give an output as follows if I am not wrong:
2 0 0
But the desired output should be:
0 0 1
This is because the byte has not changed into two bits. When n is divisible by 26, it should remain the same answer and the answer will change when (n % 26 == 1).
In the question, it is written that byte will change int two bits AFTER 16ms after it has occured. When it is as the 26th ms, it will be byte’s 16th ms, and after that it will change. Therefore, it will change between the 26th and 27th ms.