question 1
The method runs on nnrrrccc. How many characters has it written just after it reads the first c?
the answer, and why
the answer is A
Reading the first r ended nn, so 2n. Reading the first c ended rrr, so 3r. 2n3r is 4 characters; ccc is written only at the end.
if you chose another
- That is 2n alone. Reading the first c also writes rrr's run, 3r.
- That is the whole code, 2n3r3c. The last run is written only at the end.
- That counts the runs met so far, nn, rrr and c. Only runs that have ended are written.