question 1
The method runs on zztbbb. How many characters has it written just after it reads the first b?
the answer, and why
the answer is B
Reading the first t ended zz, so 2z. Reading the first b ended t, so 1t. 2z1t is 4 characters; bbb is written only at the end.
if you chose another
- That is 2z alone. Reading the first b also writes t's run, 1t.
- That is the whole code, 2z1t3b. The last run is written only at the end.
- That counts the runs met so far, zz, t and b. Only runs that have ended are written.