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